+
+
+
+
+
+
+ )
+}
+
+export class HLSUnsupportedError extends Error {
+ constructor() {
+ super('HLS is not supported')
+ }
+}
+
+export class VideoNotFoundError extends Error {
+ constructor() {
+ super('Video not found')
+ }
+}
+
+function useHLS({
+ focused,
+ playlist,
+ setHasSubtitleTrack,
+ setError,
+ videoRef,
+}: {
+ focused: boolean
+ playlist: string
+ setHasSubtitleTrack: (v: boolean) => void
+ setError: (v: Error | null) => void
+ videoRef: React.RefObject