diff --git a/apps/web/app/api/playlist/route.ts b/apps/web/app/api/playlist/route.ts index 73c35e3b..014e1e9e 100644 --- a/apps/web/app/api/playlist/route.ts +++ b/apps/web/app/api/playlist/route.ts @@ -155,7 +155,7 @@ export async function GET(request: NextRequest) { return new Response(generatedPlaylist, { status: 200, headers: { - "content-type": "application/x-mpegURL", + "content-type": "application/vnd.apple.mpegurl", "Access-Control-Allow-Origin": allowedOrigins.includes(origin) ? origin : "null", @@ -207,7 +207,7 @@ export async function GET(request: NextRequest) { return new Response(generatedPlaylist, { status: 200, headers: { - "content-type": "application/x-mpegURL", + "content-type": "application/vnd.apple.mpegurl", "Access-Control-Allow-Origin": allowedOrigins.includes(origin) ? origin : "null", diff --git a/apps/web/app/s/[videoId]/_components/VideoPlayer.tsx b/apps/web/app/s/[videoId]/_components/VideoPlayer.tsx index beff2417..f87c2117 100644 --- a/apps/web/app/s/[videoId]/_components/VideoPlayer.tsx +++ b/apps/web/app/s/[videoId]/_components/VideoPlayer.tsx @@ -26,40 +26,32 @@ export const VideoPlayer = memo( media: HTMLMediaElement, hlsInstance: React.MutableRefObject ) => { - if (Hls.isSupported() && !isIOS()) { - const hls = new Hls({ progressive: true }); - hls.on(Hls.Events.ERROR, (event, data) => { - console.error("HLS error:", data); - if (data.fatal) { - switch (data.type) { - case Hls.ErrorTypes.NETWORK_ERROR: - hls.startLoad(); - break; - case Hls.ErrorTypes.MEDIA_ERROR: - hls.recoverMediaError(); - break; - default: - break; - } + const hls = new Hls(); + hls.on(Hls.Events.ERROR, (event, data) => { + console.error("HLS error:", data); + if (data.fatal) { + switch (data.type) { + case Hls.ErrorTypes.NETWORK_ERROR: + hls.startLoad(); + break; + case Hls.ErrorTypes.MEDIA_ERROR: + hls.recoverMediaError(); + break; + default: + break; } - }); + } + }); - hlsInstance.current = hls; - hls.loadSource(src); - hls.attachMedia(media); - } else { - media.src = src; - } + hlsInstance.current = hls; + hls.loadSource(src); + hls.attachMedia(media); }; useEffect(() => { if (!videoRef.current) return; - if (isIOS()) { - videoRef.current.src = videoSrc; - } else { - initializeHls(videoSrc, videoRef.current, videoHlsInstance); - } + initializeHls(videoSrc, videoRef.current, videoHlsInstance); return () => { videoHlsInstance.current?.destroy(); @@ -75,7 +67,9 @@ export const VideoPlayer = memo( playsInline controls={false} muted - /> + > + + ); }) );