Merge pull request #1783 from VisualSJ/v1.5-5920

#5920 Audio preload error
This commit is contained in:
Jare Guo
2017-07-06 10:04:02 +08:00
committed by GitHub
2 changed files with 16 additions and 3 deletions
+11 -2
View File
@@ -85,8 +85,17 @@ Audio.State = {
(function (proto) {
proto.preload = function () {
var src = this._src,
audio = this;
var src = this._src, audio = this;
if (!src) {
this._src = '';
this._audioType = Audio.Type.UNKNOWN;
this._element = null;
this._state = Audio.State.INITIALZING;
this._loaded = false;
return;
}
var item = cc.loader.getItem(src);
if (!item) {
+5 -1
View File
@@ -41,7 +41,11 @@ var AudioSource = cc.Class({
},
ctor: function () {
this.audio = new cc.Audio(this._clip);
this.audio = new cc.Audio();
},
onLoad: function () {
this.clip = this._clip;
},
properties: {