mirror of
https://gitea.invidious.io/iv-org/invidious.git
synced 2024-08-15 00:53:41 +00:00
Update player.js
Fixes audio mode duration doubled in iPhone iOS browsers. The player will stop after reaching the real duration. iOS() checks both iOS and iPadOS. Only tested on iPhone iOS browsers. Testers needed for behavior of iPadOS and MacOS.
This commit is contained in:
parent
26ce0eb4b9
commit
685902adab
1 changed files with 24 additions and 0 deletions
|
@ -547,3 +547,27 @@ window.addEventListener('keydown', e => {
|
|||
if (player.share) {
|
||||
player.share(shareOptions);
|
||||
}
|
||||
|
||||
//iOS audio double duration fix
|
||||
player.on('loadedmetadata', function () {
|
||||
if (iOS() && video_data.params.listen) {
|
||||
player.on('timeupdate', function () {
|
||||
if (player.remainingTime() < player.duration() / 2) {
|
||||
player.currentTime(player.duration() + 1);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
function iOS() {
|
||||
return [
|
||||
'iPad Simulator',
|
||||
'iPhone Simulator',
|
||||
'iPod Simulator',
|
||||
'iPad',
|
||||
'iPhone',
|
||||
'iPod'
|
||||
].includes(navigator.platform)
|
||||
// iPad on iOS 13 detection
|
||||
|| (navigator.userAgent.includes("Mac") && "ontouchend" in document)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue