MCPcopy Create free account
hub / github.com/code100x/cms / AppxVideoPlayer

Function AppxVideoPlayer

src/components/AppxVideoPlayer.tsx:7–44  ·  view source on GitHub ↗
({
  courseId,
  videoId,
}: {
  courseId: string;
  videoId: string;
})

Source from the content-addressed store, hash-verified

5import { toast } from 'sonner';
6
7export const AppxVideoPlayer = ({
8 courseId,
9 videoId,
10}: {
11 courseId: string;
12 videoId: string;
13}) => {
14 const [url, setUrl] = useState('');
15 const doneRef = useRef(false);
16
17 useEffect(() => {
18 (async () => {
19 if (doneRef.current) return;
20 doneRef.current = true;
21 try {
22 const videoUrl = await GetAppxVideoPlayerUrl(courseId, videoId);
23 setUrl(videoUrl);
24 } catch {
25 toast.info('This is a new type of video player', {
26 description: 'Please relogin to continue',
27 action: {
28 label: 'Relogin',
29 onClick: () => signOut(),
30 },
31 });
32 }
33 })();
34 }, []);
35
36 if (!url.length) {
37 return <p>Loading...</p>;
38 }
39 return <iframe
40 src={url}
41 className="w-full rounded-lg aspect-video"
42 allowFullScreen
43 ></iframe >;
44};

Callers

nothing calls this directly

Calls 1

GetAppxVideoPlayerUrlFunction · 0.90

Tested by

no test coverage detected