mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
This commit is contained in:
parent
dfcc9bf262
commit
f48f8caa61
2 changed files with 26 additions and 1 deletions
|
@ -281,6 +281,7 @@ class PlayerSkins extends PluginAbstract {
|
|||
. "</style>";
|
||||
}
|
||||
|
||||
$css .= "<link href=\"" . getURL('plugin/PlayerSkins/pipButton.css') . "\" rel=\"stylesheet\" type=\"text/css\"/>";
|
||||
if ($obj->showShareSocial && CustomizeUser::canShareVideosFromVideo(@$video['id'])) {
|
||||
$css .= "<link href=\"" . getURL('plugin/PlayerSkins/shareButton.css') . "\" rel=\"stylesheet\" type=\"text/css\"/>";
|
||||
}
|
||||
|
@ -319,10 +320,10 @@ class PlayerSkins extends PluginAbstract {
|
|||
//$js .= "<script src=\"".getCDN()."plugin/PlayerSkins/logo.js\"></script>";
|
||||
}
|
||||
|
||||
PlayerSkins::getStartPlayerJS(file_get_contents("{$global['systemRootPath']}plugin/PlayerSkins/pipButton.js"));
|
||||
if ($obj->showShareSocial && CustomizeUser::canShareVideosFromVideo(@$video['id'])) {
|
||||
$social = getSocialModal(@$video['id'], @$url, @$title);
|
||||
PlayerSkins::getStartPlayerJS(file_get_contents("{$global['systemRootPath']}plugin/PlayerSkins/shareButton.js"));
|
||||
//$js .= "<script src=\"".getCDN()."plugin/PlayerSkins/shareButton.js\"></script>";
|
||||
$js .= $social['html'];
|
||||
$js .= "<script>function tooglePlayersocial(){showSharing{$social['id']}();}</script>";
|
||||
}
|
||||
|
|
24
plugin/PlayerSkins/pipButton.js
Normal file
24
plugin/PlayerSkins/pipButton.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Check if PiP mode is supported on this platform
|
||||
if (document.pictureInPictureEnabled) {
|
||||
// Detect when the document's visibility changes
|
||||
document.addEventListener('visibilitychange', function () {
|
||||
console.log('Picture-in-Picture visibilitychange', document.visibilityState);
|
||||
try {
|
||||
if (document.visibilityState === 'hidden') {
|
||||
if (!player.paused()) {
|
||||
player.requestPictureInPicture();
|
||||
}
|
||||
} else {
|
||||
// If the player is in PiP mode, exit it
|
||||
if (document.pictureInPictureElement) {
|
||||
document.exitPictureInPicture();
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Picture-in-Picture visibilitychange error', e);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
console.log('Picture-in-Picture mode is not supported on this platform');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue