invidious backend finished. Queueing youtube videos no longer requires
API KEY, does not directly connect to or run any youtube code/servers. Age Restricted videos are now fully queable.
This commit is contained in:
parent
f3306f2263
commit
e171415b30
5 changed files with 213 additions and 58 deletions
|
|
@ -269,6 +269,7 @@
|
|||
}
|
||||
|
||||
YouTubePlayer.prototype.load = function(data) {
|
||||
|
||||
this.setMediaProperties(data);
|
||||
if (this.yt && this.yt.ready) {
|
||||
return this.yt.loadVideoById(data.id, data.currentTime);
|
||||
|
|
@ -279,20 +280,26 @@
|
|||
|
||||
YouTubePlayer.prototype.onReady = function() {
|
||||
this.yt.ready = true;
|
||||
this.latched = true;
|
||||
handleVideoResize();
|
||||
return this.setVolume(VOLUME);
|
||||
};
|
||||
|
||||
YouTubePlayer.prototype.onStateChange = function(ev) {
|
||||
setMini();
|
||||
if (!CLIENT.leader && ev.data >= 2) {
|
||||
this.unlatch();
|
||||
}
|
||||
|
||||
if (ev.data === YT.PlayerState.PLAYING && this.pauseSeekRaceCondition) {
|
||||
this.pause();
|
||||
this.pauseSeekRaceCondition = false;
|
||||
|
||||
|
||||
}
|
||||
if ((ev.data === YT.PlayerState.PAUSED && !this.paused) || (ev.data === YT.PlayerState.PLAYING && this.paused)) {
|
||||
this.paused = ev.data === YT.PlayerState.PAUSED;
|
||||
if (CLIENT.leader) {
|
||||
sendVideoUpdate();
|
||||
}
|
||||
}
|
||||
this.paused = ev.data === YT.PlayerState.PAUSED;
|
||||
}
|
||||
if (ev.data === YT.PlayerState.ENDED && CLIENT.leader) {
|
||||
return socket.emit('playNext');
|
||||
}
|
||||
|
|
@ -319,6 +326,7 @@
|
|||
};
|
||||
|
||||
YouTubePlayer.prototype.setVolume = function(volume) {
|
||||
setMini();
|
||||
if (this.yt && this.yt.ready) {
|
||||
if (volume > 0) {
|
||||
this.yt.unMute();
|
||||
|
|
@ -329,6 +337,10 @@
|
|||
|
||||
YouTubePlayer.prototype.setQuality = function(quality) {};
|
||||
|
||||
YouTubePlayer.prototype.getRes = function(cb) {
|
||||
return cb([1920,1080]);
|
||||
};
|
||||
|
||||
YouTubePlayer.prototype.getTime = function(cb) {
|
||||
if (this.yt && this.yt.ready) {
|
||||
return cb(this.yt.getCurrentTime());
|
||||
|
|
@ -618,6 +630,7 @@
|
|||
}
|
||||
|
||||
VideoJSPlayer.prototype.loadPlayer = function(data) {
|
||||
this.latched = true;
|
||||
return waitUntilDefined(window, 'videojs', (function(_this) {
|
||||
return function() {
|
||||
var attrs, video;
|
||||
|
|
@ -1751,6 +1764,7 @@
|
|||
PLAYER = window.PLAYER;
|
||||
dispSTimes();
|
||||
PLAYER.lastSTime = data.currentTime;
|
||||
setDur();
|
||||
if (!PLAYER.latched) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue