Skip to content

Commit

Permalink
feat: option to autoplay playlist only (#3767)
Browse files Browse the repository at this point in the history
  • Loading branch information
ac615223s5 authored Jan 7, 2025
1 parent b39574a commit d49efa0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/WatchVideo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@
<input id="chkAutoLoop" v-model="selectedAutoLoop" class="ml-1.5" type="checkbox" @change="onChange($event)" />
<br />
<label for="chkAutoPlay"><strong v-text="`${$t('actions.auto_play_next_video')}:`" /></label>
<input id="chkAutoPlay" v-model="selectedAutoPlay" class="ml-1.5" type="checkbox" @change="onChange($event)" />
<select id="chkAutoPlay" v-model="selectedAutoPlay" class="ml-1.5 select" @change="onChange($event)">

Check warning on line 215 in src/components/WatchVideo.vue

View workflow job for this annotation

GitHub Actions / build

UnoCSS utilities are not ordered

Check warning on line 215 in src/components/WatchVideo.vue

View workflow job for this annotation

GitHub Actions / build

UnoCSS utilities are not ordered

Check warning on line 215 in src/components/WatchVideo.vue

View workflow job for this annotation

GitHub Actions / build

UnoCSS utilities are not ordered

Check warning on line 215 in src/components/WatchVideo.vue

View workflow job for this annotation

GitHub Actions / build

UnoCSS utilities are not ordered

Check warning on line 215 in src/components/WatchVideo.vue

View workflow job for this annotation

GitHub Actions / build-docker-image

UnoCSS utilities are not ordered

Check warning on line 215 in src/components/WatchVideo.vue

View workflow job for this annotation

GitHub Actions / build-docker-image

UnoCSS utilities are not ordered
<option value="0">none</option>
<option value="1">playlist only</option>
<option value="2">playlist and recommendations</option>
</select>

<hr />

Expand Down Expand Up @@ -424,7 +428,7 @@ export default {
},
activated() {
this.active = true;
this.selectedAutoPlay = this.getPreferenceBoolean("autoplay", false);
this.selectedAutoPlay = this.getPreferenceNumber("autoplay", 1);
this.showComments = !this.getPreferenceBoolean("minimizeComments", false);
this.showDesc = !this.getPreferenceBoolean("minimizeDescription", true);
this.showRecs = !this.getPreferenceBoolean("minimizeRecommendations", false);
Expand Down Expand Up @@ -623,8 +627,8 @@ export default {
onVideoEnded() {
if (
!this.selectedAutoLoop &&
this.selectedAutoPlay &&
(this.playlist?.relatedStreams?.length > 0 || this.video.relatedStreams.length > 0)
((this.selectedAutoPlay >= 1 && this.playlist?.relatedStreams?.length > this.index) ||
(this.selectedAutoPlay >= 2 && this.video.relatedStreams.length > 0))
) {
this.showToast();
}
Expand Down

0 comments on commit d49efa0

Please sign in to comment.