File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,23 +44,9 @@ var HTML5AudioSound = new Class({
4444 if ( ! BaseSound . prototype . play . call ( this , markerName , config ) ) {
4545 return false ;
4646 }
47- if ( ! this . pickAudioTag ( ) ) {
48- this . reset ( ) ;
47+ if ( ! this . pickAndPlayAudioTag ( ) ) {
4948 return false ;
5049 }
51- var seek = this . currentConfig . seek ;
52- var delay = this . currentConfig . delay ;
53- var offset = ( this . currentMarker ? this . currentMarker . start : 0 ) + seek ;
54- this . audio . currentTime = offset ;
55- this . applyConfig ( ) ;
56- if ( delay === 0 ) {
57- this . startTime = 0 ;
58- this . audio . play ( ) ;
59- }
60- else {
61- this . startTime = window . performance . now ( ) + delay ;
62- }
63- this . resetConfig ( ) ;
6450 this . events . dispatch ( new SoundEvent ( this , 'SOUND_PLAY' ) ) ;
6551 return true ;
6652 } ,
@@ -96,6 +82,26 @@ var HTML5AudioSound = new Class({
9682 this . events . dispatch ( new SoundEvent ( this , 'SOUND_STOP' ) ) ;
9783 return true ;
9884 } ,
85+ pickAndPlayAudioTag : function ( ) {
86+ if ( ! this . pickAudioTag ( ) ) {
87+ this . reset ( ) ;
88+ return false ;
89+ }
90+ var seek = this . currentConfig . seek ;
91+ var delay = this . currentConfig . delay ;
92+ var offset = ( this . currentMarker ? this . currentMarker . start : 0 ) + seek ;
93+ this . audio . currentTime = offset ;
94+ this . applyConfig ( ) ;
95+ if ( delay === 0 ) {
96+ this . startTime = 0 ;
97+ this . audio . play ( ) ;
98+ }
99+ else {
100+ this . startTime = window . performance . now ( ) + delay ;
101+ }
102+ this . resetConfig ( ) ;
103+ return true ;
104+ } ,
99105 pickAudioTag : function ( ) {
100106 if ( ! this . audio ) {
101107 for ( var i = 0 ; i < this . tags . length ; i ++ ) {
You can’t perform that action at this time.
0 commit comments