Commit e73d2550 authored by liujiangnan's avatar liujiangnan

feat

parent 431000f3
...@@ -95,35 +95,36 @@ cc.Class({ ...@@ -95,35 +95,36 @@ cc.Class({
cc.macro.ENABLE_TRANSPARENT_CANVAS = true; cc.macro.ENABLE_TRANSPARENT_CANVAS = true;
this.node.on('ready-to-play', () => { this.videoPlayer.node.on('ready-to-play', () => {
console.log('ready-to-play'); console.log('ready-to-play');
}); });
this.node.on('meta-loaded', () => { this.videoPlayer.node.on('meta-loaded', () => {
console.log('meta-loaded'); console.log('meta-loaded');
this._isReadyToPlay = true; this._isReadyToPlay = true;
this.durationLabel.string = this.formatTime(this.videoPlayer.getDuration()); this.durationLabel.string = this.formatTime(this.videoPlayer.getDuration());
// this.videoPlayer.resume(); // this.videoPlayer.resume();
this.videoPlayer.stop(); this.videoPlayer.stop();
}); });
this.node.on('clicked', () => { this.videoPlayer.node.on('clicked', () => {
console.log('clicked'); console.log('clicked');
}); });
this.node.on('playing', () => { this.videoPlayer.node.on('playing', () => {
console.log('playing'); console.log('playing');
this.durationLabel.string = this.formatTime(this.videoPlayer.getDuration());
this.playButton.node.active = false; this.playButton.node.active = false;
this.pauseButton.node.active = true; this.pauseButton.node.active = true;
}); });
this.node.on('paused', () => { this.videoPlayer.node.on('paused', () => {
console.log('paused'); console.log('paused');
// this.playButton.node.active = true; // this.playButton.node.active = true;
// this.pauseButton.node.active = false; // this.pauseButton.node.active = false;
}); });
this.node.on('stopped', () => { this.videoPlayer.node.on('stopped', () => {
console.log('stopped'); console.log('stopped');
// this.playButton.node.active = true; // this.playButton.node.active = true;
// this.pauseButton.node.active = false; // this.pauseButton.node.active = false;
}); });
this.node.on('completed', () => { this.videoPlayer.node.on('completed', () => {
console.log('completed'); console.log('completed');
this.videoPlayer.currentTime = 0; this.videoPlayer.currentTime = 0;
// this.playButton.node.active = true; // this.playButton.node.active = true;
...@@ -142,7 +143,6 @@ cc.Class({ ...@@ -142,7 +143,6 @@ cc.Class({
// this.initListener(); // this.initListener();
this.initdDrag(); this.initdDrag();
// console.log(11111) // console.log(11111)
// this.videoPlayer = this.node.getComponent(cc.VideoPlayer);
this.videoPlayer.getImpl = function() { this.videoPlayer.getImpl = function() {
return this._impl; return this._impl;
} }
...@@ -205,8 +205,8 @@ cc.Class({ ...@@ -205,8 +205,8 @@ cc.Class({
this.updateBarByPos(newX); this.updateBarByPos(newX);
// console.log("ProgressBar TOUCH_START", newX); // console.log("ProgressBar TOUCH_START", newX);
}); });
this.node.off(cc.Node.EventType.TOUCH_START); this.videoPlayer.node.off(cc.Node.EventType.TOUCH_START);
this.node.on(cc.Node.EventType.TOUCH_START, (e) => { this.videoPlayer.node.on(cc.Node.EventType.TOUCH_START, (e) => {
console.log("screen TOUCH_START"); console.log("screen TOUCH_START");
this.triggerInteractive() this.triggerInteractive()
}); });
...@@ -324,7 +324,7 @@ cc.Class({ ...@@ -324,7 +324,7 @@ cc.Class({
this.currentTimeLabel.string = this.formatTime(ct); this.currentTimeLabel.string = this.formatTime(ct);
const dur = this.videoPlayer.getDuration(); const dur = this.videoPlayer.getDuration();
const percent = ct / dur; const percent = ct / dur;
const maxX = this.ProgressBar.node.width; const maxX = this.ProgressBar.node.width-20;
const minX = 0; const minX = 0;
let newX = percent * maxX; let newX = percent * maxX;
newX = Math.min(maxX, Math.max(newX, minX)); newX = Math.min(maxX, Math.max(newX, minX));
......
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