removed old todos, disable captions on load

This commit is contained in:
mrjvs 2023-10-27 22:12:03 +02:00
parent 9ff603f87c
commit 65d0218f81
4 changed files with 10 additions and 5 deletions

View File

@ -127,7 +127,6 @@ function CustomCaptionOption() {
);
}
// TODO fix language names, some are unknown
export function CaptionsView({ id }: { id: string }) {
const router = useOverlayRouter(id);
const lang = usePlayerStore((s) => s.caption.selected?.language);

View File

@ -81,8 +81,8 @@ export function useCaptions() {
}, [lastSelectedLanguage, search, download]);
const toggleLastUsed = useCallback(async () => {
if (!enabled) await downloadLastUsed();
else disable();
if (enabled) disable();
else await downloadLastUsed();
}, [downloadLastUsed, disable, enabled]);
return {

View File

@ -8,8 +8,7 @@ export function useVolume() {
const display = usePlayerStore((s) => s.display);
const setStoredVolume = useVolumeStore((s) => s.setVolume);
const toggleVolume = (_isKeyboardEvent = false) => {
// TODO use keyboard event
const toggleVolume = () => {
let newVolume = 0;
if (volume > 0) {

View File

@ -1,7 +1,9 @@
import { RunOutput } from "@movie-web/providers";
import { useCallback, useEffect, useState } from "react";
import { useHistory, useParams } from "react-router-dom";
import { useEffectOnce } from "react-use";
import { useCaptions } from "@/components/player/hooks/useCaptions";
import { usePlayer } from "@/components/player/hooks/usePlayer";
import { usePlayerMeta } from "@/components/player/hooks/usePlayerMeta";
import { convertRunoutputToSource } from "@/components/player/utils/convertRunoutputToSource";
@ -30,6 +32,7 @@ export function PlayerView() {
const { status, playMedia, reset, setScrapeNotFound } = usePlayer();
const { setPlayerMeta, scrapeMedia } = usePlayerMeta();
const backUrl = useLastNonPlayerLink();
const { disable } = useCaptions();
const paramsData = JSON.stringify({
media: params.media,
@ -63,6 +66,10 @@ export function PlayerView() {
[playMedia, startAtParam]
);
useEffectOnce(() => {
disable();
});
return (
<PlayerPart backUrl={backUrl} onMetaChange={metaChange}>
{status === playerStatus.IDLE ? (