pstream is dead; long live pstream taciturnaxolotl.github.io/pstream-ng/

Revert testview to how it was before

vlOd2 ceecfc7a ca61d3b9

+2 -71
+2 -71
src/pages/developer/TestView.tsx
··· 1 - import { useCallback, useState } from "react"; 1 + import { useState } from "react"; 2 2 3 3 import { Button } from "@/components/buttons/Button"; 4 - import { usePlayer } from "@/components/player/hooks/usePlayer"; 5 - import { PlaybackErrorPart } from "@/pages/parts/player/PlaybackErrorPart"; 6 - import { PlayerPart } from "@/pages/parts/player/PlayerPart"; 7 - import { 8 - CaptionListItem, 9 - PlayerMeta, 10 - playerStatus, 11 - } from "@/stores/player/slices/source"; 12 - import { SourceSliceSource } from "@/stores/player/utils/qualities"; 13 - 14 - const subtitlesTestMeta: PlayerMeta = { 15 - type: "movie", 16 - title: "Subtitles Test", 17 - releaseYear: 2024, 18 - tmdbId: "0", 19 - }; 20 - 21 - const subtitlesTestSource: SourceSliceSource = { 22 - type: "hls", 23 - url: "http://localhost:8000/media/master.m3u8", 24 - }; 25 - 26 - const subtitlesTestSubs: CaptionListItem[] = [ 27 - { 28 - id: "http://localhost:8000/subs/en.srt", 29 - display: "English", 30 - language: "en", 31 - url: "http://localhost:8000/subs/en.srt", 32 - needsProxy: false, 33 - }, 34 - { 35 - id: "http://localhost:8000/subs/en-small.srt", 36 - display: "English Small", 37 - language: "en", 38 - url: "http://localhost:8000/subs/en-small.srt", 39 - needsProxy: false, 40 - }, 41 - { 42 - id: "http://localhost:8000/subs/ro.srt", 43 - display: "Romanian", 44 - language: "ro", 45 - url: "http://localhost:8000/subs/ro.srt", 46 - needsProxy: false, 47 - }, 48 - ]; 49 4 50 5 // mostly empty view, add whatever you need 51 6 export default function TestView() { 52 - const player = usePlayer(); 53 - const [showPlayer, setShowPlayer] = useState(false); 54 7 const [shouldCrash, setShouldCrash] = useState(false); 55 8 56 9 if (shouldCrash) { 57 10 throw new Error("I crashed"); 58 11 } 59 12 60 - const subtitlesTest = useCallback(async () => { 61 - setShowPlayer(true); 62 - player.reset(); 63 - await new Promise((r) => { 64 - setTimeout(r, 100); 65 - }); 66 - player.setShouldStartFromBeginning(true); 67 - player.setMeta(subtitlesTestMeta); 68 - player.playMedia(subtitlesTestSource, subtitlesTestSubs, null); 69 - }, [player]); 70 - 71 - return showPlayer ? ( 72 - <PlayerPart backUrl="/dev/"> 73 - {player && (player as any).status === playerStatus.PLAYBACK_ERROR ? ( 74 - <PlaybackErrorPart /> 75 - ) : null} 76 - </PlayerPart> 77 - ) : ( 78 - <> 79 - <Button onClick={() => setShouldCrash(true)}>Crash me!</Button> 80 - <Button onClick={() => subtitlesTest()}>Subtitles test</Button> 81 - </> 82 - ); 13 + return <Button onClick={() => setShouldCrash(true)}>Crash me!</Button>; 83 14 }