Skip to content

Commit

Permalink
first fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan1986 committed Aug 14, 2021
1 parent 23b408e commit 0879251
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
3 changes: 3 additions & 0 deletions src/app/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'));
40 changes: 22 additions & 18 deletions src/app/lib/views/player/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down Expand Up @@ -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');
});
Expand Down Expand Up @@ -443,31 +446,32 @@
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
* mouseup instead of mousedown for pause/play on the
* 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);
Expand Down
1 change: 1 addition & 0 deletions src/app/styl/views/player.styl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
position: absolute
overflow: hidden
background-color: #000
font-size: 10px;
video {
width: 100%
height: 100%
Expand Down

0 comments on commit 0879251

Please sign in to comment.