diff options
| author | Féry Mathieu (Mathius) <ferymathieuy@gmail.com> | 2022-02-12 17:34:19 +0100 |
|---|---|---|
| committer | Féry Mathieu (Mathius) <ferymathieuy@gmail.com> | 2022-02-14 17:01:10 +0100 |
| commit | 17ae2648edb63ca0ca0d08b346adea1ada61d252 (patch) | |
| tree | 14f1af8377cab5cb35c6a071da5d37eeb6e17d49 | |
| parent | c952754c8cdf7d0eb51e827e625b9872cf75fd12 (diff) | |
| download | invidious-17ae2648edb63ca0ca0d08b346adea1ada61d252.tar.gz invidious-17ae2648edb63ca0ca0d08b346adea1ada61d252.tar.bz2 invidious-17ae2648edb63ca0ca0d08b346adea1ada61d252.zip | |
Modify use of module (Only if video settings are default)
Following remark at https://github.com/iv-org/invidious/pull/2895#issuecomment-1037279953
| -rw-r--r-- | assets/js/player.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/assets/js/player.js b/assets/js/player.js index 5880bedc..34f721b4 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -176,8 +176,16 @@ if (video_data.params.video_start > 0 || video_data.params.video_end > 0) { player.currentTime(video_data.params.video_start); } -player.volume(video_data.params.volume / 100); -player.playbackRate(video_data.params.speed); +/* + If the video settings are default, we enable the management of the settings by + the videojs-persist module otherwise we apply the preferences. +*/ +if (video_data.params.volume == 100 && video_data.params.speed == "1.0") + player.persist(); +else { + player.volume(video_data.params.volume / 100); + player.playbackRate(video_data.params.speed); +} player.on('waiting', function () { if (player.playbackRate() > 1 && player.liveTracker.isLive() && player.liveTracker.atLiveEdge()) { @@ -677,6 +685,3 @@ if (window.location.pathname.startsWith("/embed/")) { cb = player.getChild('ControlBar') cb.addChild(watch_on_invidious_button) }; - -// Add usage of videojs-persist -player.persist(); |
