diff options
| author | 138138138 <78271024+138138138@users.noreply.github.com> | 2021-02-02 21:25:13 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-02 21:25:13 +0800 |
| commit | a6970e02f937112bbc9f8be4fa69e820b8381e1b (patch) | |
| tree | 66cbcff8a4559b3890958136c4163cc4cdbc584c /assets/js | |
| parent | 685902adabb7da522587f6308495701891a8b5fe (diff) | |
| download | invidious-a6970e02f937112bbc9f8be4fa69e820b8381e1b.tar.gz invidious-a6970e02f937112bbc9f8be4fa69e820b8381e1b.tar.bz2 invidious-a6970e02f937112bbc9f8be4fa69e820b8381e1b.zip | |
Fix double duration on all Apple devices
The fix will be applied when Safari browser is detected.
Diffstat (limited to 'assets/js')
| -rw-r--r-- | assets/js/player.js | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/assets/js/player.js b/assets/js/player.js index 3c4188d0..29b62147 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -548,9 +548,9 @@ if (player.share) { player.share(shareOptions); } -//iOS audio double duration fix +// Safari audio double duration fix player.on('loadedmetadata', function () { - if (iOS() && video_data.params.listen) { + if (navigator.vendor == "Apple Computer, Inc." && video_data.params.listen) { player.on('timeupdate', function () { if (player.remainingTime() < player.duration() / 2) { player.currentTime(player.duration() + 1); @@ -558,16 +558,3 @@ player.on('loadedmetadata', function () { }) } }); - -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) -} |
