Added raw file youtube support as holdover until invidious embed is
viable. This does not help with region locking, but at least allows age restricted videos with no sign in, doesnt run any google scripts, and does not run ads.
This commit is contained in:
parent
5535917f08
commit
3f653c4893
9 changed files with 122 additions and 57 deletions
|
|
@ -859,7 +859,6 @@ Callbacks = {
|
|||
if (isNaN(VOLUME) || VOLUME > 1 || VOLUME < 0) {
|
||||
VOLUME = 1;
|
||||
}
|
||||
|
||||
function loadNext() {
|
||||
if(PLAYER){
|
||||
PLAYER.latch();
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ var USEROPTS = {
|
|||
sort_rank : getOrDefault("sort_rank", true),
|
||||
sort_afk : getOrDefault("sort_afk", false),
|
||||
legacy_emote : getOrDefault("legacy_emote", false),
|
||||
yt_source : getOrDefault("yt_source", "vid.puffyan.us"),
|
||||
show_seconds : getOrDefault("show_seconds", false),
|
||||
default_quality : getOrDefault("default_quality", "auto"),
|
||||
boop : getOrDefault("boop", "never"),
|
||||
|
|
|
|||
|
|
@ -250,7 +250,10 @@ fpset.ocall = function(){
|
|||
|
||||
$("<form>").append(
|
||||
$("<label>").prop("for","qs-yt-source").html("Youtube Source: "),
|
||||
$("<select>").prop("id","qs-yt-source").addClass("qs-form"),
|
||||
$("<select>").prop("id","qs-yt-source").addClass("qs-form").change(function(){
|
||||
USEROPTS.yt_source = $("#qs-yt-source").val();
|
||||
processOpts();
|
||||
}),
|
||||
),
|
||||
|
||||
|
||||
|
|
@ -310,9 +313,11 @@ fpset.ocall = function(){
|
|||
|
||||
fpset.loadSettings = function(){
|
||||
$("#us-theme").children().clone().appendTo($("#qs-theme"));
|
||||
$("#us-yt-source").children().clone().appendTo($("#qs-yt-source"));
|
||||
$("#qs-theme").val(USEROPTS.theme);
|
||||
$("#qs-orient-buttons").prop("checked", USEROPTS.show_orientation);
|
||||
$("#qs-sync-threshold").val(USEROPTS.sync_accuracy);
|
||||
$("#qs-yt-source").val(USEROPTS.yt_source);
|
||||
$("#qs-legacy-emote").prop("checked", USEROPTS.legacy_emote);
|
||||
$("#us-blink-title").children().clone().appendTo($("#qs-blink-title"));
|
||||
$("#qs-blink-title").val(USEROPTS.blink_title);
|
||||
|
|
|
|||
|
|
@ -242,30 +242,43 @@
|
|||
}
|
||||
this.setMediaProperties(data);
|
||||
this.pauseSeekRaceCondition = false;
|
||||
waitUntilDefined(window, 'YT', (function(_this) {
|
||||
return function() {
|
||||
return waitUntilDefined(YT, 'Player', function() {
|
||||
var wmode;
|
||||
removeOld();
|
||||
wmode = USEROPTS.wmode_transparent ? 'transparent' : 'opaque';
|
||||
return _this.yt = new YT.Player('ytapiplayer', {
|
||||
videoId: data.id,
|
||||
playerVars: {
|
||||
autohide: 1,
|
||||
autoplay: 1,
|
||||
controls: 1,
|
||||
iv_load_policy: 3,
|
||||
rel: 0,
|
||||
wmode: wmode
|
||||
},
|
||||
events: {
|
||||
onReady: _this.onReady.bind(_this),
|
||||
onStateChange: _this.onStateChange.bind(_this)
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
})(this));
|
||||
if(USEROPTS.yt_source == "OFYT"){
|
||||
waitUntilDefined(window, 'YT', (function(_this) {//THIS IS WHERE YT VIDEO EMBED IS CREATED, RIP DIS BITCH!
|
||||
return function() {
|
||||
return waitUntilDefined(YT, 'Player', function() {
|
||||
var wmode;
|
||||
removeOld();
|
||||
wmode = USEROPTS.wmode_transparent ? 'transparent' : 'opaque';
|
||||
return _this.yt = new YT.Player('ytapiplayer', {
|
||||
videoId: data.id,
|
||||
playerVars: {
|
||||
autohide: 1,
|
||||
autoplay: 1,
|
||||
controls: 1,
|
||||
iv_load_policy: 3,
|
||||
rel: 0,
|
||||
wmode: wmode
|
||||
},
|
||||
events: {
|
||||
onReady: _this.onReady.bind(_this),
|
||||
onStateChange: _this.onStateChange.bind(_this)
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
})(this));
|
||||
}else{
|
||||
var video;
|
||||
video = $('<iframe/>');
|
||||
removeOld(video);
|
||||
video.attr({
|
||||
src: "https://" + USEROPTS.yt_source + "/embed/" + data.id,
|
||||
webkitallowfullscreen: true,
|
||||
mozallowfullscreen: true,
|
||||
allowfullscreen: true
|
||||
});
|
||||
this.inv = video;
|
||||
}
|
||||
}
|
||||
|
||||
YouTubePlayer.prototype.load = function(data) {
|
||||
|
|
@ -299,6 +312,10 @@
|
|||
}
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
if (ev.data === YT.PlayerState.ENDED && CLIENT.leader) {
|
||||
return socket.emit('playNext');
|
||||
|
|
@ -729,7 +746,6 @@
|
|||
});
|
||||
_this.player.on('canplay', function() {
|
||||
handleWindowResize();
|
||||
return console.log(_this.player.children);
|
||||
});
|
||||
_this.player.on('timeupdate', function() {
|
||||
return setDur();
|
||||
|
|
@ -1742,14 +1758,24 @@
|
|||
error = error1;
|
||||
console.error(error);
|
||||
}
|
||||
if (data.meta.direct && data.type === 'vi') {
|
||||
if ((data.meta.direct && data.type === 'vi')) {
|
||||
try {
|
||||
return window.PLAYER = new VideoJSPlayer(data);
|
||||
} catch (error1) {
|
||||
e = error1;
|
||||
return console.error(e);
|
||||
}
|
||||
} else if (data.type in TYPE_MAP) {
|
||||
} else if ((USEROPTS.yt_source !== "OFYT" && data.type == "yt")) {
|
||||
data.id = data.meta.rawLink;//set link and spoof mov/h264
|
||||
data.type = "fi";
|
||||
data.meta.codec = "mov/h264";
|
||||
try {
|
||||
return window.PLAYER = new FilePlayer(data);
|
||||
} catch (error1) {
|
||||
e = error1;
|
||||
return console.error(e);
|
||||
}
|
||||
}else if (data.type in TYPE_MAP) {
|
||||
try {
|
||||
return window.PLAYER = TYPE_MAP[data.type](data);
|
||||
} catch (error1) {
|
||||
|
|
|
|||
|
|
@ -713,6 +713,7 @@ function showUserOptions() {
|
|||
$("#us-playlistbuttons").prop("checked", USEROPTS.qbtn_hide);
|
||||
$("#us-oldbtns").prop("checked", USEROPTS.qbtn_idontlikechange);
|
||||
$("#us-video-orientation").prop("checked", USEROPTS.show_orientation);
|
||||
$("#us-yt-source").val(USEROPTS.yt_source);
|
||||
$("#us-default-quality").val(USEROPTS.default_quality || "auto");
|
||||
|
||||
$("#us-chat-timestamp").prop("checked", USEROPTS.show_timestamps);
|
||||
|
|
@ -751,6 +752,7 @@ function saveUserOptions() {
|
|||
USEROPTS.qbtn_hide = $("#us-playlistbuttons").prop("checked");
|
||||
USEROPTS.qbtn_idontlikechange = $("#us-oldbtns").prop("checked");
|
||||
USEROPTS.show_orientation = $("#us-video-orientation").prop("checked");
|
||||
USEROPTS.yt_source = $("#us-yt-source").val();
|
||||
USEROPTS.default_quality = $("#us-default-quality").val();
|
||||
|
||||
USEROPTS.show_timestamps = $("#us-chat-timestamp").prop("checked");
|
||||
|
|
@ -850,6 +852,14 @@ function applyOpts() {
|
|||
USEROPTS.notifications = "never";
|
||||
}
|
||||
}
|
||||
if((USEROPTS.yt_source == "OFYT" && window.PLAYER.mediaType == "fi" && window.PLAYER.mediaId.includes("google")) || (USEROPTS.yt_source != "OFYT" && window.PLAYER.mediaType == "yt")){
|
||||
PLAYER.mediaType = "";
|
||||
PLAYER.mediaId = "";
|
||||
|
||||
console.log("switch");
|
||||
socket.emit("playerReady");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function parseTimeout(t) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue