File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -186,17 +186,15 @@ var HTML5AudioSound = new Class({
186186 var startTime = this . currentMarker ? this . currentMarker . start : 0 ;
187187 var endTime = startTime + this . duration ;
188188 var currentTime = this . audio . currentTime ;
189- if ( currentTime >= endTime ) {
190- if ( this . currentConfig . loop ) {
191- this . audio . currentTime = startTime + ( currentTime - endTime ) ;
192- currentTime = this . audio . currentTime ;
193- }
194- else {
195- this . reset ( ) ;
196- this . stopAndReleaseAudioTag ( ) ;
197- this . events . dispatch ( new SoundEvent ( this , 'SOUND_ENDED' ) ) ;
198- return ;
199- }
189+ if ( this . currentConfig . loop && currentTime >= endTime - this . manager . loopEndOffset ) {
190+ this . audio . currentTime = startTime + Math . max ( 0 , currentTime - endTime ) ;
191+ currentTime = this . audio . currentTime ;
192+ }
193+ else if ( currentTime >= endTime ) {
194+ this . reset ( ) ;
195+ this . stopAndReleaseAudioTag ( ) ;
196+ this . events . dispatch ( new SoundEvent ( this , 'SOUND_ENDED' ) ) ;
197+ return ;
200198 }
201199 else if ( currentTime < startTime ) {
202200 this . audio . currentTime += startTime ;
You can’t perform that action at this time.
0 commit comments