mirror of
https://codeberg.org/ashley/poke
synced 2025-05-30 02:59:43 +00:00
hai
This commit is contained in:
parent
024bea2b33
commit
f661ee76a9
@ -3471,7 +3471,62 @@ More Epic options owo~
|
|||||||
// @license-end
|
// @license-end
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const video = document.querySelector('video');
|
||||||
|
|
||||||
|
if (!video) return;
|
||||||
|
|
||||||
|
if ('mediaSession' in navigator) {
|
||||||
|
// Set metadata
|
||||||
|
navigator.mediaSession.metadata = new MediaMetadata({
|
||||||
|
title: "<%= inv_vid.title %>",
|
||||||
|
artist: "<%= video?.Channel?.Name || k.Video.Channel.Name %>",
|
||||||
|
album: "PokeTube",
|
||||||
|
artwork: [
|
||||||
|
{
|
||||||
|
src: "https://i.ytimg.com/vi/<%=inv_vid.videoId%>/maxresdefault.jpg",
|
||||||
|
sizes: "1280x720",
|
||||||
|
type: "image/jpeg"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update playback state
|
||||||
|
const updatePositionState = () => {
|
||||||
|
if ('setPositionState' in navigator.mediaSession) {
|
||||||
|
navigator.mediaSession.setPositionState({
|
||||||
|
duration: video.duration || 0,
|
||||||
|
playbackRate: video.playbackRate || 1,
|
||||||
|
position: video.currentTime || 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
video.addEventListener('timeupdate', updatePositionState);
|
||||||
|
video.addEventListener('ratechange', updatePositionState);
|
||||||
|
video.addEventListener('loadedmetadata', updatePositionState);
|
||||||
|
|
||||||
|
// Media control handlers
|
||||||
|
navigator.mediaSession.setActionHandler('play', () => {
|
||||||
|
video.play();
|
||||||
|
});
|
||||||
|
|
||||||
|
navigator.mediaSession.setActionHandler('pause', () => {
|
||||||
|
video.pause();
|
||||||
|
});
|
||||||
|
|
||||||
|
navigator.mediaSession.setActionHandler('seekto', (details) => {
|
||||||
|
if (details.fastSeek && 'fastSeek' in video) {
|
||||||
|
video.fastSeek(details.seekTime);
|
||||||
|
} else {
|
||||||
|
video.currentTime = details.seekTime;
|
||||||
|
}
|
||||||
|
updatePositionState();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<script>
|
<script>
|
||||||
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-3.0-or-later
|
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-3.0-or-later
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user