1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-20 14:37:43 +01:00

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 }) { export function CaptionsView({ id }: { id: string }) {
const router = useOverlayRouter(id); const router = useOverlayRouter(id);
const lang = usePlayerStore((s) => s.caption.selected?.language); const lang = usePlayerStore((s) => s.caption.selected?.language);

View file

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

View file

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

View file

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