summaryrefslogtreecommitdiffstats
path: root/assets/js/player.js
diff options
context:
space:
mode:
author138138138 <78271024+138138138@users.noreply.github.com>2022-03-27 18:32:00 +0800
committerGitHub <noreply@github.com>2022-03-27 18:32:00 +0800
commit2c22b0839f7dced5e82c1f1b23e040ea0849461d (patch)
treeb65261d8b8620321f1abcd95d6f5278efdcdf339 /assets/js/player.js
parentf4e19ac05c33f0a0995fe9cbb7678cd0b90a3149 (diff)
downloadinvidious-2c22b0839f7dced5e82c1f1b23e040ea0849461d.tar.gz
invidious-2c22b0839f7dced5e82c1f1b23e040ea0849461d.tar.bz2
invidious-2c22b0839f7dced5e82c1f1b23e040ea0849461d.zip
Safari audio double duration fix for iOS 15
The previous method breaks Always Loop feature on iOS 15. The previous player.currentTime(player.duration() + 1) sometimes breaks the entire player. Now it jumps to (end - 1) seconds when the time goes between over half and (end - 2) seconds. With Always Loop on, player will jump to the beginning after 1 second.
Diffstat (limited to 'assets/js/player.js')
-rw-r--r--assets/js/player.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/assets/js/player.js b/assets/js/player.js
index a1a2cd16..74cdd987 100644
--- a/assets/js/player.js
+++ b/assets/js/player.js
@@ -675,8 +675,8 @@ if (player_data.preferred_caption_found) {
if (navigator.vendor == "Apple Computer, Inc." && video_data.params.listen) {
player.on('loadedmetadata', function () {
player.on('timeupdate', function () {
- if (player.remainingTime() < player.duration() / 2) {
- player.currentTime(player.duration() + 1);
+ if (player.remainingTime() < player.duration() / 2 && player.remainingTime() >= 2) {
+ player.currentTime(player.duration() - 1);
}
});
});