feat(viewer): loop toggle in video player settings (#3508)

Adds a Loop switch to the video player's settings panel. The choice is
persisted via the player's local storage so it survives across files
and sessions.

Authored By: TDvorak <info@tdvorak.dev>

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
pull/3582/head
Tomas Dvorak 2 weeks ago
parent 6f23834b87
commit 7f3463ec68

@ -230,6 +230,7 @@
"color": "Color", "color": "Color",
"fontSize": "Font size", "fontSize": "Font size",
"disableSubtitle": "Disable subtitle", "disableSubtitle": "Disable subtitle",
"loop": "Loop",
"noSubtitle": "No ASS/SRT/VTT subtitle files found under current folder.", "noSubtitle": "No ASS/SRT/VTT subtitle files found under current folder.",
"subtitleStyles": "Subtitle styles", "subtitleStyles": "Subtitle styles",
"subtitles": "Subtitles", "subtitles": "Subtitles",

@ -230,6 +230,7 @@
"color": "颜色", "color": "颜色",
"fontSize": "字体大小", "fontSize": "字体大小",
"disableSubtitle": "禁用字幕", "disableSubtitle": "禁用字幕",
"loop": "循环播放",
"noSubtitle": "没有在当前目录下找到 ASS/SRT/VTT 字幕文件。", "noSubtitle": "没有在当前目录下找到 ASS/SRT/VTT 字幕文件。",
"subtitleStyles": "字幕样式", "subtitleStyles": "字幕样式",
"subtitles": "字幕", "subtitles": "字幕",

@ -469,6 +469,26 @@ const VideoViewer = () => {
fontSize: `${subtitleStyle.fontSize ?? 20}px`, fontSize: `${subtitleStyle.fontSize ?? 20}px`,
}, },
}, },
settings: [
{
name: "loop",
html: t("application:fileManager.loop"),
switch: false,
mounted(item: any) {
const enabled = this.storage.get("loop") === true;
if (enabled) {
item.switch = true;
this.loop = true;
}
},
onSwitch(item: any) {
const next = !item.switch;
this.loop = next;
this.storage.set("loop", next);
return next;
},
},
],
plugins: [], plugins: [],
lang: t("artPlayerLocaleCode", { ns: "common" }), // TODO: review lang: t("artPlayerLocaleCode", { ns: "common" }), // TODO: review
}} }}

Loading…
Cancel
Save