Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
"options_video_shuffle_scope_hint": {
"message": "If the selected category has no videos in the current source, all videos will play instead."
},
"options_video_repeat_current": {
"message": "Repeat current video"
},
"shuffle_scope_all": {
"message": "All"
},
Expand Down
3 changes: 3 additions & 0 deletions src/_locales/ja/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
"options_video_shuffle_scope_hint": {
"message": "現在のソースに選択したカテゴリの動画がない場合、すべての動画が再生されます。"
},
"options_video_repeat_current": {
"message": "現在の動画を繰り返す"
},
"shuffle_scope_all": {
"message": "すべて"
},
Expand Down
3 changes: 3 additions & 0 deletions src/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
"options_video_shuffle_scope_hint": {
"message": "如果当前视频源中没有所选类别的视频,将改为播放所有视频。"
},
"options_video_repeat_current": {
"message": "重复播放当前视频"
},
"shuffle_scope_all": {
"message": "所有视频"
},
Expand Down
3 changes: 3 additions & 0 deletions src/_locales/zh_TW/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
"options_video_shuffle_scope_hint": {
"message": "如果目前影片來源中沒有所選類別的影片,將改為播放所有影片。"
},
"options_video_repeat_current": {
"message": "重複播放目前影片"
},
"shuffle_scope_all": {
"message": "所有影片"
},
Expand Down
7 changes: 6 additions & 1 deletion src/components/VideoBackground.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@
scheduleVideoChange(scopes);
}

function handleVideoEnded() {
if (!settings.repeatCurrentVideo) nextVideo();
}

function onCanPlay() {
opacity = 1;
consecutiveErrors = 0;
Expand Down Expand Up @@ -154,9 +158,10 @@
src={currentUrl}
autoplay
muted
loop={settings.repeatCurrentVideo}
style:opacity={opacity}
oncanplay={onCanPlay}
onended={nextVideo}
onended={handleVideoEnded}
onerror={onError}
></video>
{/key}
Expand Down
1 change: 1 addition & 0 deletions src/lib/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const DEFAULTS = Object.freeze({
videoSrc: 'apple',
reverseProxy: true,
shuffleScopes: ['all'],
repeatCurrentVideo: false,
showVideoMetadata: true,
translateMotto: false,
zenMusic: true,
Expand Down
12 changes: 12 additions & 0 deletions src/options/sections/VideoSection.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@
{t('options_video_shuffle_scope_hint')}
</p>

<label class="flex items-center justify-between gap-4">
<span class="text-sm text-slate-700">
{t('options_video_repeat_current')}
</span>
<input
type="checkbox"
class="h-4 w-4 cursor-pointer accent-blue-600"
checked={settings.repeatCurrentVideo}
onchange={bindSetting('repeatCurrentVideo')}
/>
</label>

{#if settings.videoSrc === 'apple'}
<label class="flex items-center justify-between gap-4">
<span class="text-sm text-slate-700">
Expand Down