Commit acccaca8 authored by liujiangnan's avatar liujiangnan

feat

parent fb2dcfa5
......@@ -143,8 +143,8 @@ cc.Class({
},
// use this for initialization
_isPlayComplated: null,
onLoad () {
cc.debug.setDisplayStats(false);
this.initSize();
......@@ -197,6 +197,7 @@ cc.Class({
this.videoPlayer.node.on('completed', async () => {
console.log('completed');
// this.videoPlayer.currentTime = 0;
this._isPlayComplated = true;
this.playButton.node.active = false;
this.pauseButton.node.active = false;
this.restartButton.node.active = true;
......@@ -226,15 +227,12 @@ cc.Class({
this.barTag.off(cc.Node.EventType.TOUCH_MOVE);
this.barTag.on(cc.Node.EventType.TOUCH_MOVE,(e) => {
var delta = e.getDelta();
let newX = this.barTag.x+delta.x;
let newX = this.barTag.x+delta.x*2;
newX = Math.min(maxX, Math.max(newX, minX));
this.barTag.x = newX;
const percent = newX / maxX;
// console.log(newX, percent);
const dur = this.videoPlayer.getDuration();
// this.videoPlayer.currentTime = percent * dur
// this.updateBarByPos(this.barTag.x);
this.currentTimeLabel.string = this.formatTime(percent * dur );
this.triggerInteractive()
});
......@@ -378,6 +376,9 @@ cc.Class({
this.videoPlayer.currentTime = percent * dur
},
updateBarByTime(ct){
if (this._isPlayComplated) {
return;
}
this.currentTimeLabel.string = this.formatTime(ct);
const dur = this.videoPlayer.getDuration();
const percent = ct / dur;
......@@ -449,6 +450,7 @@ cc.Class({
},
replay(){
this._isPlayComplated = false;
this.videoPlayer.currentTime = 0;
this.videoPlayer.play();
this.triggerInteractive();
......
......@@ -7,8 +7,8 @@
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1280,
"height": 720,
"width": 1920,
"height": 1080,
"platformSettings": {},
"subMetas": {
"bg": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment