File tree 1 file changed +8
-6
lines changed
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({
134
134
//TODO Maybe loader shift in will be better
135
135
volume : 1 ,
136
136
loop : false ,
137
+ src : null ,
137
138
_touch : false ,
138
139
139
140
_playing : false ,
140
141
_AUDIO_TYPE : "AUDIO" ,
141
142
_pause : false ,
142
- _src : null ,
143
143
144
144
//Web Audio
145
145
_buffer : null ,
@@ -557,8 +557,9 @@ cc.Audio = cc.Class.extend({
557
557
* cc.audioEngine.playMusic(path, false);
558
558
*/
559
559
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 ( ) ;
562
563
}
563
564
var audio = loader . cache [ url ] ;
564
565
if ( ! audio ) {
@@ -866,9 +867,10 @@ cc.Audio = cc.Class.extend({
866
867
867
868
_pauseCache : [ ] ,
868
869
_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 ) ;
872
874
}
873
875
var ap = this . _audioPool ;
874
876
for ( var p in ap ) {
You can’t perform that action at this time.
0 commit comments