Sound effect delayed after first time it's played - createjs

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

Related

Delay in the start of audio emit

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.

CreateJS MovieClip performance issue

I'm using Adobe Animate HTML5 to create a board game to run on Smart TV (low-performance machine).
All my previous games were done using AS3.
I quickly found there is no way to create a Sprite anymore (A movie clips with only 1 frame).
After creating my board game (no code yet just elements) which is basically movie clips inside other movie clips. All single frame.
I checked the FPS on LG TV and so it is done from 60 to 20. On a static image.
After research, I found that is the advance method in MovieClip class there is a constant check to update the frame.
I added a change to check if the MovieClip class total frame is equal to 1 to change it the mode of the MovieClip to a single frame. This increases performance back to 60 FPS.
Who do I go to, to check and maybe fix/"add a feature" to the code of createjs
Thanks
code issues or suggestions can be logged here https://github.com/CreateJS/EaselJS/issues for CreateJS. All the best.
inside html-code in script part there is a line
createjs.Ticker.addEventListener("tick", stage);
Remove it and call the update manually when you need it (when something has changed)
stage.update();

How to stop MPAndroidChart chart.centerViewToAnimated( currentXVisible + 60, currentY, YAxis.AxisDependency.LEFT, 15000 );

I am wanting to animate my drawn data, with controls much like a media player: Play, Stop, fast forward, etc....over my Xaxis - AKA over time....
I have tried creating my own Runnable both on and off the UI thread with no success with making calls to increment the xvalue by small amounts, etc .... but does not move the view port windows.
I can get my chart to animate using chart.centerViewToAnimated, but want to be able to "stop" this animation ... I cannot see how to do this even with a ViewPortHandler...
Any ideas??
It looks like the animation started by chart.centerViewToAnimated(...) cannot be cancelled. So you need to make small steps. If the steps are small enough, you can use chart.centerViewTo(...) (without animation).
I have implemented this with 50ms interval and it looks decent.

gsap, revert animation after play

I'd like to play an animation with gsap, but after it has finished playing, I want to reset it. Like after playing that animation, reset, after it is finished. Without clicking anywhere or calculating the play time, sleeping or waiting the process. Just simply something like:
TweenLite.to(thing, 1, {x:'-20px'}).reset();
(ideally, there is no reset call in gsap.. how to acieve this?)
I can't get it to work with .seek(), .time(), .pause().
Those always interrupt the animation.
Preferable I want to use a simple TweenLite, or if it has to, a TimelineLite.
Im searching / looking for it since hours..
There are many ways to do it, but here's a simple one:
TweenLite.to(thing, 1, {x:-20, onComplete:function() {
this.pause(0); //seeks the tween (this) to 0 (playhead's starting position) and pauses immediately.
}});
Does that help?

How to hear sound from mpmovieplayer at a specific time using UISlider?

I'm working on an iOS movie editor project. For this editor, i use MPMoviePlayer to show the video file selected by the user.
I use custom controls, and I have a UISlider that enables the user to move the player's currentTime position. When the user touches the slider, movie is paused and its currentTime changes along with the UISlider's value.
Everything works perfectly, but now i need to let the user hear the sound at this currentTime position.
For those who know iMovie, when you move your mouse over a movie event, you see the image and hear the sound at this position, and that's what i'd like in my editor.
I've tried to call player's play method with à NSTimer to stop after 0.2 seconds, but the result is kind of messy.
Has anyone already achieved to do something like this ?
Thanks !
Best regards.
Seeking takes time; that's why you've ended up using a timer. The real problem here is that MPMoviePlayerController, while convenient because it gives you controls, is a blunt instrument; it's just a massive simplified convenience built on top of AVFoundation. But you don't need the built-in controls, so I would suggest throwing away your entire implementation and getting down to the real stuff, using AVFoundation instead (AVPlayer etc). Now you have a coherent way to seek and get a notification when the seek has completed (seekToTime:completionHandler:), so you'll be able to start playing as soon as possible. Plus, AVFoundation is the level where you'll be doing all your "editing" anyway.