mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
Merge pull request #570 from knoxHuang/fixBug
Fix CCAudioSource volume and mute invalid bug
This commit is contained in:
@@ -203,8 +203,15 @@ var AudioSource = cc.Class({
|
||||
*/
|
||||
play: function () {
|
||||
if ( this._clip ) {
|
||||
this.audio = audioEngine.playEffect(this._clip, this._loop);
|
||||
// this.audio.play();
|
||||
var volume = this._mute ? 0 : this._volume;
|
||||
if (cc.sys.isNative) {
|
||||
audioEngine.playEffect(this._clip, this._loop);
|
||||
cc.audioEngine.setEffectsVolume(volume);
|
||||
}
|
||||
else {
|
||||
this.audio = audioEngine.playEffect(this._clip, this._loop);
|
||||
this.audio.setVolume(volume);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user