refactor private method of videoPlayer component

This commit is contained in:
zilongshanren
2016-06-15 11:22:58 +08:00
parent 15f861a68c
commit ae42b8950b
+6 -6
View File
@@ -74,10 +74,10 @@ var VideoPlayer = cc.Class({
type: ResourceType,
set: function ( value ) {
this._resourceType = value;
this._updateSgNode();
this._updateVideoSource();
},
get: function () {
return this._resourceType
return this._resourceType;
}
},
@@ -92,7 +92,7 @@ var VideoPlayer = cc.Class({
type: cc.String,
set: function ( url ) {
this._remoteURL = url;
this._updateSgNode();
this._updateVideoSource();
},
get: function () {
return this._remoteURL;
@@ -117,7 +117,7 @@ var VideoPlayer = cc.Class({
if (typeof value !== 'string')
value = '';
this._clip = value;
this._updateSgNode();
this._updateVideoSource();
},
url: cc.RawAsset
},
@@ -203,7 +203,7 @@ var VideoPlayer = cc.Class({
return new _ccsg.VideoPlayer();
},
_updateSgNode: function () {
_updateVideoSource: function () {
var sgNode = this._sgNode;
if (this.resourceType === ResourceType.REMOTE) {
sgNode.setURL(this.remoteURL);
@@ -215,7 +215,7 @@ var VideoPlayer = cc.Class({
_initSgNode: function () {
var sgNode = this._sgNode;
if(sgNode) {
this._updateSgNode();
this._updateVideoSource();
sgNode.seekTo(this.currentTime);
sgNode.setKeepAspectRatioEnabled(this.keepAspectRatio);