mirror of
https://github.com/iv-org/invidious.git
synced 2025-05-02 14:36:24 -04:00
Add DASH quality preference
The options are `auto` (the current and default behavior), `best` and `worst`. The UI is only updated once playback starts.
This commit is contained in:
parent
c7c732ebc0
commit
eea7ca9b72
6 changed files with 38 additions and 1 deletions
|
@ -154,6 +154,18 @@ if (video_data.params.autoplay) {
|
|||
|
||||
if (!video_data.params.listen && video_data.params.quality === 'dash') {
|
||||
player.httpSourceSelector();
|
||||
|
||||
if (video_data.params.quality_dash != "auto") {
|
||||
player.ready(() => {
|
||||
player.on("loadedmetadata", () => {
|
||||
const qualityLevels = Array.from(player.qualityLevels()).sort((a, b) => a.height - b.height);
|
||||
const targetQualityLevel = video_data.params.quality_dash == "best" ? qualityLevels.length - 1 : 0;
|
||||
for (let i = 0; i < qualityLevels.length; i++) {
|
||||
qualityLevels[i].enabled = (i == targetQualityLevel)
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
player.vttThumbnails({
|
||||
|
@ -510,4 +522,6 @@ window.addEventListener('keydown', e => {
|
|||
}());
|
||||
|
||||
// Since videojs-share can sometimes be blocked, we defer it until last
|
||||
player.share(shareOptions);
|
||||
if (player.share) {
|
||||
player.share(shareOptions);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue