1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00
Daniel 2021-11-08 12:31:24 -03:00
parent ced2b1dd89
commit 9fe8bd5e5b
2 changed files with 35 additions and 20 deletions

View file

@ -4720,7 +4720,11 @@ function getVideoIDFromURL($url) {
return intval($matches[1]); return intval($matches[1]);
} }
if (preg_match('/\/(video|videoEmbed|v|vEmbed|article|articleEmbed)\/([0-9]+)/', $url, $matches)) { if (preg_match('/\/(video|videoEmbed|v|vEmbed|article|articleEmbed)\/([0-9]+)/', $url, $matches)) {
if(is_numeric($matches[1])){
return intval($matches[1]); return intval($matches[1]);
}else if(is_numeric($matches[2])){
return intval($matches[2]);
}
} }
if (AVideoPlugin::isEnabledByName('PlayLists')) { if (AVideoPlugin::isEnabledByName('PlayLists')) {
if (preg_match('/player.php\?playlists_id=([0-9]+)/', $url, $matches)) { if (preg_match('/player.php\?playlists_id=([0-9]+)/', $url, $matches)) {

View file

@ -229,22 +229,30 @@ function removeTracks() {
function changeVideoSrc(vid_obj, source) { function changeVideoSrc(vid_obj, source) {
var srcs = []; var srcs = [];
removeTracks(); removeTracks();
var autoLoad = true;
for (i = 0; i < source.length; i++) { for (i = 0; i < source.length; i++) {
if (source[i].type) { if (source[i].type) {
console.log(source[i].type);
if (source[i].type === "application/x-mpegURL") { if (source[i].type === "application/x-mpegURL") {
// it is HLS cancel it // it is HLS cancel it
return false; //return false;
autoLoad = false;
} }
srcs.push(source[i]); srcs.push(source[i]);
} else if (source[i].srclang) { } else if (source[i].srclang) {
player.addRemoteTextTrack(source[i]); player.addRemoteTextTrack(source[i]);
} }
} }
console.log('changeVideoSrc srcs', srcs);
vid_obj.src(srcs); vid_obj.src(srcs);
setTimeout(function () { setTimeout(function () {
if (autoLoad) {
changeVideoSrcLoad(); changeVideoSrcLoad();
}else{
player.play();
}
}, 1000); }, 1000);
return true; return true;
} }
@ -869,6 +877,8 @@ function playNext(url) {
console.log("playNext changing location " + url); console.log("playNext changing location " + url);
document.location = url; document.location = url;
} else { } else {
forceCurrentTime = 0;
setCurrentTime(0);
console.log("playNext ajax"); console.log("playNext ajax");
$.ajax({ $.ajax({
url: webSiteRootURL + 'view/infoFromURL.php?url=' + encodeURI(url), url: webSiteRootURL + 'view/infoFromURL.php?url=' + encodeURI(url),
@ -877,7 +887,7 @@ function playNext(url) {
if (!response || response.error) { if (!response || response.error) {
console.log("playNext ajax fail"); console.log("playNext ajax fail");
if (response.url) { if (response.url) {
//document.location = response.url; document.location = response.url;
} }
} else { } else {
console.log("playNext ajax success"); console.log("playNext ajax success");
@ -895,6 +905,7 @@ function playNext(url) {
return false; return false;
} }
$('video, #mainVideo').attr('poster', response.poster); $('video, #mainVideo').attr('poster', response.poster);
player.poster(response.poster);
history.pushState(null, null, url); history.pushState(null, null, url);
$('.topInfoTitle, title').text(response.title); $('.topInfoTitle, title').text(response.title);
$('#topInfo img').attr('src', response.userPhoto); $('#topInfo img').attr('src', response.userPhoto);