Skip to content

Commit

Permalink
feat: add option to favor hls over dash
Browse files Browse the repository at this point in the history
  • Loading branch information
snematoda committed Jul 11, 2024
1 parent 174a4cc commit f00b9ca
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/components/PreferencesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
<strong v-t="'actions.audio_only'" />
<input id="chkAudioOnly" v-model="listen" class="checkbox" type="checkbox" @change="onChange($event)" />
</label>
<label class="pref" for="chkPreferHls">
<strong v-t="'actions.prefer_hls'" />
<input id="chkPreferHls" v-model="preferHls" class="checkbox" type="checkbox" @change="onChange($event)" />
</label>
<label class="pref" for="ddlDefaultQuality">
<strong v-t="'actions.default_quality'" />
<select id="ddlDefaultQuality" v-model="defaultQuality" class="select w-auto" @change="onChange($event)">
Expand Down Expand Up @@ -438,6 +442,7 @@ export default {
autoPlayNextCountdown: 5,
listen: false,
resolutions: [144, 240, 360, 480, 720, 1080, 1440, 2160, 4320],
preferHls: false,
defaultQuality: 0,
bufferingGoal: 10,
countryMap: CountryMap,
Expand Down Expand Up @@ -619,6 +624,7 @@ export default {
localStorage.setItem("autoDisplayCaptions", this.autoDisplayCaptions);
localStorage.setItem("autoPlayNextCountdown", this.autoPlayNextCountdown);
localStorage.setItem("listen", this.listen);
localStorage.setItem("preferHls", this.preferHls);
localStorage.setItem("quality", this.defaultQuality);
localStorage.setItem("bufferGoal", this.bufferingGoal);
localStorage.setItem("region", this.countrySelected);
Expand Down
7 changes: 6 additions & 1 deletion src/components/VideoPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,12 @@ export default {
if (this.video.livestream) {
uri = this.video.hls;
mime = "application/x-mpegURL";
} else if (this.video.audioStreams.length > 0 && !lbry && MseSupport) {
} else if (
this.video.audioStreams.length > 0 &&
!lbry &&
MseSupport &&
!this.getPreferenceBoolean("preferHls", false)
) {
if (!this.video.dash) {
const dash = (await import("../utils/DashUtils.js")).generate_dash_file_from_formats(
streams,
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@
"creator_replied": "Creator replied",
"creator_liked": "Creator liked",
"playback_speed": "Playback speed",
"invalid_input": "Invalid input"
"invalid_input": "Invalid input",
"prefer_hls": "Prefer HLS over DASH"
},
"comment": {
"pinned_by": "Pinned by {author}",
Expand Down

0 comments on commit f00b9ca

Please sign in to comment.