mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-23 05:57:21 +00:00
Implement better support for playback rate changes (#730)
* Implement better support for playback rate changes. * Add isNaN check for duration.
This commit is contained in:
parent
6948fb6269
commit
2bb7288451
@ -349,8 +349,10 @@ export default {
|
|||||||
this.setPreference("volume", videoEl.volume);
|
this.setPreference("volume", videoEl.volume);
|
||||||
});
|
});
|
||||||
|
|
||||||
videoEl.addEventListener("ratechange", () => {
|
videoEl.addEventListener("ratechange", e => {
|
||||||
this.setPreference("rate", videoEl.playbackRate);
|
const rate = videoEl.playbackRate;
|
||||||
|
if (rate > 0 && !isNaN(videoEl.duration) && !isNaN(videoEl.duration - e.timeStamp / 1000))
|
||||||
|
this.setPreference("rate", rate);
|
||||||
});
|
});
|
||||||
|
|
||||||
videoEl.addEventListener("ended", () => {
|
videoEl.addEventListener("ended", () => {
|
||||||
@ -489,7 +491,10 @@ export default {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
videoEl.volume = this.getPreferenceNumber("volume", 1);
|
videoEl.volume = this.getPreferenceNumber("volume", 1);
|
||||||
player.trickPlay(this.getPreferenceNumber("rate", 1));
|
const rate = this.getPreferenceNumber("rate", 1);
|
||||||
|
player.trickPlay(rate);
|
||||||
|
player.playbackRate = rate;
|
||||||
|
player.defaultPlaybackRate = rate;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async updateProgressDatabase(time) {
|
async updateProgressDatabase(time) {
|
||||||
|
Loading…
Reference in New Issue
Block a user