add setting

This commit is contained in:
Alin 2023-02-15 12:34:33 +00:00
parent 10ba5891a3
commit f4b370945a
4 changed files with 32 additions and 1 deletions

View file

@ -45,6 +45,25 @@
@change="onChange($event)"
/>
</label>
<label v-if="autoPlayVideo" class="pref" for="chkPriorityAutoPlay">
<div class="flex items-center">
<strong v-t="'actions.priority_autoplay'" />
<font-awesome-icon icon="circle-question" class="ml-2 peer" />
<div class="peer hidden peer-hover:block relative w-0 h-0">
<div
class="absolute sm:min-w-xs min-w-[12rem] bottom-5 bg-black/80 rounded p-2"
v-t="'actions.priority_autoplay_tooltip'"
/>
</div>
</div>
<input
id="chkPriorityAutoPlay"
v-model="priorityAutoPlay"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
<label class="pref" for="chkAudioOnly">
<strong v-t="'actions.audio_only'" />
<input id="chkAudioOnly" v-model="listen" class="checkbox" type="checkbox" @change="onChange($event)" />
@ -403,6 +422,7 @@ export default {
showMarkers: true,
selectedTheme: "dark",
autoPlayVideo: true,
priorityAutoPlay: false,
listen: false,
resolutions: [144, 240, 360, 480, 720, 1080, 1440, 2160, 4320],
defaultQuality: 0,
@ -548,6 +568,7 @@ export default {
this.showMarkers = this.getPreferenceBoolean("showMarkers", true);
this.selectedTheme = this.getPreferenceString("theme", "dark");
this.autoPlayVideo = this.getPreferenceBoolean("playerAutoPlay", true);
this.priorityAutoPlay = this.getPreferenceBoolean("priorityAutoPlay", false);
this.listen = this.getPreferenceBoolean("listen", false);
this.defaultQuality = Number(localStorage.getItem("quality"));
this.bufferingGoal = Math.max(Number(localStorage.getItem("bufferGoal")), 10);
@ -609,6 +630,7 @@ export default {
localStorage.setItem("showMarkers", this.showMarkers);
localStorage.setItem("theme", this.selectedTheme);
localStorage.setItem("playerAutoPlay", this.autoPlayVideo);
localStorage.setItem("priorityAutoPlay", this.priorityAutoPlay);
localStorage.setItem("listen", this.listen);
localStorage.setItem("quality", this.defaultQuality);
localStorage.setItem("bufferGoal", this.bufferingGoal);

View file

@ -58,6 +58,9 @@ export default {
shouldAutoPlay: _this => {
return _this.getPreferenceBoolean("playerAutoPlay", true) && !_this.isEmbed;
},
priorityAutoPlay: _this => {
return _this.getPreferenceBoolean("priorityAutoPlay", true) && !_this.isEmbed;
},
preferredVideoCodecs: _this => {
var preferredVideoCodecs = [];
const enabledCodecs = _this.getPreferenceString("enabledCodecs", "vp9,avc").split(",");
@ -396,7 +399,9 @@ export default {
}
});
}
if (this.priorityAutoPlay) {
this.setNextVideo();
}
//TODO: Add sponsors on seekbar: https://github.com/ajayyy/SponsorBlock/blob/e39de9fd852adb9196e0358ed827ad38d9933e29/src/js-components/previewBar.ts#L12
},

View file

@ -45,6 +45,8 @@
"dark": "Dark",
"light": "Light",
"autoplay_video": "Autoplay Video",
"priority_autoplay": "Priority Autoplay",
"priority_autoplay_tooltip": "Prioritize unwatched videos from the same channel when selecting next video from related streams.",
"audio_only": "Audio Only",
"default_quality": "Default Quality",
"buffering_goal": "Buffering Goal (in seconds)",

View file

@ -21,6 +21,7 @@ import {
faServer,
faDonate,
faBookmark,
faCircleQuestion,
} from "@fortawesome/free-solid-svg-icons";
import { faGithub, faBitcoin, faYoutube } from "@fortawesome/free-brands-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
@ -48,6 +49,7 @@ library.add(
faServer,
faDonate,
faBookmark,
faCircleQuestion,
);
import router from "@/router/router.js";