Delay in the start of audio emit - just-audio

I’m seeing two intermittent issues using just_audio for playback on iOS. They have continued for months, but are seemingly random and I’ve not found how to reproduce. Has anyone else had this and know how to solve it?
Scenario 1: Many times when playing audio, I have noticed that it starts with some delay. just_audio reports the change of position and states but I have a couple of seconds of no audio. If I pause the playback, or change the position, everything settles and corrects itself and everything works correctly.
Scenario 2: Sometimes audio is playing and then just stops emitting sound. It still is reporting position and stage so it seems like playback is happening. Seeking to another spot will get it to start emitting sound again. Hitting pause will also kick it to get sound coming out again.
These may be different issues, but they feel related and both have only been seen to happen on iOS and not Android.

Related

iMac 10.9.5 Mavericks making high-pitched sound when viewing samples of some processes

Does anybody have an educated guess into why my iMac 10.9.5. Mavericks is making a high-pitched sound when I am viewing samples of processes? Latest to do this was a sample of font daemon "fontd" run by atsserver (apple type service server).
It seems very weird since, if I drag the window of the sample so that it is not visible on the screen, the high pitch noise stops – and immediately when I drag the window so that I can see the sampled text, the sound comes back. The pitch is very high, somewhere around 18kHz. Many times it seems the samples that make the noise seem to have the DataDetectorsCore associated.
The sound only comes when viewing the sample of the process in the Activity Monitor. So if I save it as text and view it then, the sound is not there.
What could be going on here?
Thank you for any good guesses!

Sound effect delayed after first time it's played

I am using the SoundJS library within the CreateJS suite. I use the LoadQueue class to preload all my sounds. I am finding that when I go to play a sound effect for the first time it's delayed by a good half second before it plays. After the first play, it will play perfectly after that.
The problem also re-occurrs if you don't play any sounds for a minute or so. Then playing a sound effect will have that delay on first play.
Any idea why? Is there a work around to fix the issue? (ie. playing background music at 0% volume.
Here is my code (using typescript) :
import ReelStop from "../sound/reelstop.mp3";
private queue = new createjs.LoadQueue();
this.queue.installPlugin(createjs.Sound);
this.queue.on("complete", this.handleComplete, this);
this.queue.addEventListener("progress", this.onProgress);
this.queue.loadManifest([
// other sounds and images
{id: "reelStop", src: ReelStop},
]);
// after the preload complete has fired, the first time the sound is played there is that 500ms+ delay :
const reelStop= createjs.Sound.play("reelStop");
reelStop.volume = 0.5;
Thanks in advance for any ideas you may have

How do I process video frames in HTML5 quickly?

I am testing HTML5's video API. The plan is to have a video play with an effect, like making it black and white. I have and working together using a buffer. I take the current video frame and copy to the scratch buffer where I can process it. The problem is the rate at which it runs.
The Video API of HTML5 has the 'timeupdate' event. I tried using this to have the handler process frames, once for every frame, but it runs at a slower rate than the video.
Any ideas to speed up processing frames?
You can get much more frequent redraws by using requestAnimationFrame to determine when to update your canvas, rather than relying on timeupdate, which only updates every 200-250ms. It's definitely not enough for frame-accurate animation. requestAnimationFrame will update at most every 16ms (approx 60fps), but the browser will throttle it as necessary and sync with video buffer draw calls. It's pretty much exactly what you want for this sort of thing.
Even with higher frame rates, processing video frames with a 2D canvas is going to be pretty slow. For one thing, you're processing every pixel sequentially in the CPU, running Javascript. The other problem is that you're copying around a lot of memory. There's no way to directly access pixels in a video element. Instead, you have to copy the whole frame into a canvas first. Then, you have to call getImageData, which not only copies the whole frame a second time, but it also has to allocate the whole block of memory again, since it creates a new ImageData every time. Would be nice if you could copy into an existing buffer, but you can't.
It turns out you can do extremely fast image processing with WebGL. I've written a library called Seriously.js for exactly this purpose. Check out the wiki for a FAQ and tutorial. There's a Hue/Saturation plugin you can use - just drop the saturation to -1 to get your video to grayscale.
The code will look something like this:
var composition = new Seriously();
var effect = composition.effect('hue-saturation');
var target = composition.target('#mycanvas');
effect.source = '#myvideo';
effect.saturation = -1;
target.source = effect;
composition.go();
The big down side of using WebGL is that not every browser or computer will support it - Internet Explorer is out, as is any machine with old or weird video drivers. Most mobile browsers don't support it. You can get good stats on it here and here. But you can get very high frame rates on pretty large videos, even with much more complex effects.
(There is also a small issue with a browser bug that, oddly enough, shows up in both Chrome and Firefox. Your canvas will often be one frame behind the video, which is only an issue if the video is paused, and is most egregious if you're skipping around. The only workaround seems to be to keep forcing updates, even if your video is paused, which is less efficient. Please feel free to vote those tickets up so they get some attention.)

AVPlayer seekToTime: Poor performance while looping short videos

this is my first question, but I've readed StackOverflow for years.
Well the thing is that I must concatenate a set of videos (MP4) in a particular order, and the last one must loop continuously. Okay, let's try AVFoundation.
I've defined all the elements such as AVComposition, AVURLAsset and AVPlayerItem. Then I build the AVPlayer and the AVPlayerLayer. Everything is okay and the videos are played in the correct order but... (and here comes the problem)
I can note a tiny flick when the AVPlayer passes from one video to the next one. I can ignore that one, but when AVPlayer reaches AVPlayerItem's end, and the selector is called for AVPlayerItemDidPlayToEndTimeNotification, I use seekToTime to move the reading head to the correct and then play it again. Works fine, but a GREAT flick is repeated when using seekToTime and playing again. I cannot allow that.
Does anybody know how to repeat the last asset on AVPlayerItem continuously and without flicks?
Thank you all.
Absolutely stupid,
Friends, when making video manipulation apps be sure that the videos don't have annoying black frames. That was the root of all problems. [AVPlayer seekToTime:] works perfectly.
Thanks for your time and patience

Sencha Touch - Scroll Delay on First Touch

I have been searching around and it looks like this question has been asked quite a few times in various places with no answers or responses. That means that I can't be the only one experiencing this.
There is always a delay in the scrolling when you try to scroll a list or panel for the first time. After the first time you scroll a list or panel, there is no longer any delay. Is there a way I can simulate this "first touch" in an effort to remove the delay when attempting to scroll a list or panel for the first time?
I've been looking through the ScrollView and Scroller code and have not been able to find a point where anything heavy or expensive is happening on a first touch.
Any help or direction on how to remedy this would be greatly appreciated.
Thanks!
You can open the Chrome/Safari developer tools and start profiling("Profiles" tab) to see if there is any JavaScript code that is performing badly and causing the hang.
If it's not code that hangs, it might be a web browser issue (e.g. image cache allocation), for example due to the first time that things dynamically change in your web app.
It's also important to try and compare platforms and see if they have the same issue.
It's also often helpful if you specify the Sencha version (I assume 1.x?) and the platform(s) you've had the issue with. iOS/Android/PC can often react quite differently.