File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -134,12 +134,12 @@ cc.Audio = cc.Class.extend({
134134 //TODO Maybe loader shift in will be better
135135 volume : 1 ,
136136 loop : false ,
137+ src : null ,
137138 _touch : false ,
138139
139140 _playing : false ,
140141 _AUDIO_TYPE : "AUDIO" ,
141142 _pause : false ,
142- _src : null ,
143143
144144 //Web Audio
145145 _buffer : null ,
@@ -557,8 +557,9 @@ cc.Audio = cc.Class.extend({
557557 * cc.audioEngine.playMusic(path, false);
558558 */
559559 playMusic : function ( url , loop ) {
560- if ( this . _currMusic && this . _currMusic . _src !== url ) {
561- this . _currMusic . stop ( ) ;
560+ var bgMusic = this . _currMusic ;
561+ if ( bgMusic && bgMusic . src !== url ) {
562+ bgMusic . stop ( ) ;
562563 }
563564 var audio = loader . cache [ url ] ;
564565 if ( ! audio ) {
@@ -866,9 +867,10 @@ cc.Audio = cc.Class.extend({
866867
867868 _pauseCache : [ ] ,
868869 _pausePlaying : function ( ) {
869- if ( this . _currMusic . getPlaying ( ) ) {
870- this . _currMusic . pause ( ) ;
871- this . _pauseCache . push ( this . _currMusic ) ;
870+ var bgMusic = this . _currMusic ;
871+ if ( bgMusic && bgMusic . getPlaying ( ) ) {
872+ bgMusic . pause ( ) ;
873+ this . _pauseCache . push ( bgMusic ) ;
872874 }
873875 var ap = this . _audioPool ;
874876 for ( var p in ap ) {
You can’t perform that action at this time.
0 commit comments