From 0879251a1fd3100af780b7fe58d86b9d279a75e3 Mon Sep 17 00:00:00 2001 From: Ivan Borzenkov Date: Wed, 11 Aug 2021 17:28:28 +0300 Subject: [PATCH] first fixes --- src/app/global.js | 3 +++ src/app/lib/views/player/player.js | 40 ++++++++++++++++-------------- src/app/styl/views/player.styl | 1 + 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/app/global.js b/src/app/global.js index 912d980d64..0fa6a7112c 100644 --- a/src/app/global.js +++ b/src/app/global.js @@ -37,6 +37,7 @@ var _ = require('underscore'), // Torrent engines WebTorrent = require('webtorrent'), torrentCollection = require('torrentcollection4'), + videojs = require('video.js'), // VPN VPNht = require('@vpnht/sdk'), // NodeJS @@ -48,5 +49,7 @@ var _ = require('underscore'), // setting default filters status curSetDefaultFilters = false; +require('videojs-youtube'); + dayjs.extend(require('dayjs/plugin/relativeTime')); dayjs.extend(require('dayjs/plugin/localizedFormat')); diff --git a/src/app/lib/views/player/player.js b/src/app/lib/views/player/player.js index 526c4e3ada..4527841e5f 100644 --- a/src/app/lib/views/player/player.js +++ b/src/app/lib/views/player/player.js @@ -156,6 +156,8 @@ if (type === 'episode') { type = 'show'; } + console.log('===='); + console.log(this.video); if (this.video.currentTime() / this.video.duration() >= 0.8 && type !== undefined && this.model.get('metadataCheckRequired') !== false) { App.vent.trigger(type + ':watched', this.model.attributes, 'database'); } @@ -404,12 +406,13 @@ // start videojs engine if (this.model.get('type') === 'video/youtube') { - this.video = videojs('video_player', { + this.video = videojs($('#video_player').get(0), { techOrder: ['youtube'], forceSSL: true, - ytcontrols: false, - quality: '720p' - }).ready(function () { + ytcontrols: true, + quality: '720p', + }); + this.video.ready(function () { that.player && that.player.cache_ && that.player.cache_.volume ? that.player.volume(Settings.playerVolume) : null; this.addClass('vjs-has-started'); }); @@ -443,12 +446,13 @@ customSubtitles: {}, progressTips: {} } - }).ready(function () { + }); + this.video.ready(function () { that.playerWasReady = Date.now(); }); $('head > title').text(this.model.get('title') + ' - Popcorn-Time' ); } - this.player = this.video.player(); + this.player = this.video;//.player(); App.PlayerView = this; /* The following is a hack to make VideoJS listen to @@ -456,18 +460,18 @@ * video element. Stops video pausing/playing when * dragged. TODO: #fixit! */ - this.player.tech.off('mousedown'); - this.player.tech.on('mouseup', function (event) { - if (event.target.origEvent) { - if (!event.target.origEvent.originalEvent.defaultPrevented) { - that.player.tech.onClick(event); - } - // clean up after ourselves - delete event.target.origEvent; - } else { - that.player.tech.onClick(event); - } - }); + // this.player.tech.off('mousedown'); + // this.player.tech.on('mouseup', function (event) { + // if (event.target.origEvent) { + // if (!event.target.origEvent.originalEvent.defaultPrevented) { + // that.player.tech.onClick(event); + // } + // // clean up after ourselves + // delete event.target.origEvent; + // } else { + // that.player.tech.onClick(event); + // } + // }); // Force custom controls this.player.usingNativeControls(false); diff --git a/src/app/styl/views/player.styl b/src/app/styl/views/player.styl index effb1b0bd3..c1af1e7e77 100644 --- a/src/app/styl/views/player.styl +++ b/src/app/styl/views/player.styl @@ -15,6 +15,7 @@ position: absolute overflow: hidden background-color: #000 + font-size: 10px; video { width: 100% height: 100%