SoundChannel object plays small portion after being stopped and played again
- by gok
SoundChannel object is stopped and played again. When played again it plays small portion from the previous position and suddenly jumps back to the beginning. It doesn't play the whole sound before looping.
This happens only once, then it loops normally. It happens again if I stop and play.
public function play():void {
channel = clip.play(trimIn);
volume(currentVolume);
isPlaying = true;
timer.start();
channel.addEventListener(Event.SOUND_COMPLETE, loopMusic);
}
public function loopMusic(e:Event=null):void {
if (channel != null) {
timer.stop();
channel.removeEventListener(Event.SOUND_COMPLETE, loopMusic);
play();
}
}
Do I need to somehow reset the soundChannel?