({
courseId,
videoId,
}: {
courseId: string;
videoId: string;
})
| 5 | import { toast } from 'sonner'; |
| 6 | |
| 7 | export 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 | }; |
nothing calls this directly
no test coverage detected