From 4854743f641fcbf9a4b0b39c0514d0a94a0bef9b Mon Sep 17 00:00:00 2001 From: "wuji.xwt" Date: Wed, 8 Sep 2021 11:42:52 +0800 Subject: [PATCH] chore: remove unused file --- src/video-canvas.js | 91 --------------------------------------------- 1 file changed, 91 deletions(-) delete mode 100644 src/video-canvas.js diff --git a/src/video-canvas.js b/src/video-canvas.js deleted file mode 100644 index b1719210..00000000 --- a/src/video-canvas.js +++ /dev/null @@ -1,91 +0,0 @@ -import videojs from 'video.js'; - -const ClickableComponent = videojs.getComponent('ClickableComponent'); - -/** - * This class reacts to interactions with the canvas and - * triggers appropriate functionality on the player. Right now - * it does two things: - * - * 1. A `mousedown`/`touchstart` followed by `touchend`/`mouseup` without any - * `touchmove` or `mousemove` toggles play/pause on the player - * 2. Only moving on/clicking the control bar or toggling play/pause should - * show the control bar. Moving around the scene in the canvas should not. - */ -class VideoCanvas extends ClickableComponent { - constructor(player, options) { - super(player, options); - - this.player_.controlBar.on([ - 'mousedown', - 'mousemove', - 'mouseup', - 'touchstart', - 'touchmove', - 'touchend' - ], this.onControlBarMove); - - // we have to override these here because - // video.js listens for user activity on the video element - // and makes the user active when the mouse moves. - // We don't want that for 3d videos - this.oldReportUserActivity = this.player_.reportUserActivity; - this.player_.reportUserActivity = () => {}; - - // canvas movements - this.on('mousemove', this.onMove); - // this.on('tap', this.togglePlay); - this.shouldTogglePlay = false; - } - - onTap(e) { - } - - handleClick(e) { - if (e.type !== 'tap' && !this.shouldTogglePlay) { - this.shouldTogglePlay = true; - return; - } - - this.togglePlay(); - } - - togglePlay() { - if (this.player_.paused()) { - this.player_.play(); - } else { - this.player_.pause(); - } - } - - onMove(e) { - this.shouldTogglePlay = false; - } - - onControlBarMove(e) { - this.player_.userActive(true); - } - - dispose() { - super.dispose(); - - this.player_.controlBar.off([ - 'mousedown', - 'mousemove', - 'mouseup', - 'touchstart', - 'touchmove', - 'touchend' - ], this.onControlBarMove); - - this.player_.reportUserActivity = this.oldReportUserActivity; - } -} - -VideoCanvas.prototype.options_ = { - reportTouchActivity: false -}; - -videojs.registerComponent('VideoCanvas', VideoCanvas); - -export default VideoCanvas;