Mneckoee
Mneckoee

Reputation: 3074

How to Seamlessly Update HLS Stream URL in ExoPlayer When Manifest Expires (HTTP 483) Without Interrupting Playback?

I am using ExoPlayer to play an HLS stream in a Kotlin-based Android app. Our media server changes the stream links every minute to avoid video link leakage. If I request .ts chunks based on an expired manifest file (.m3u8), the server responds with an HTTP error code 483, indicating that I need to retrieve the new stream link.

Situation:
At the start of playback, ExoPlayer downloads a valid manifest and then fetches the first 10 .ts chunks (e.g., 001.ts to 010.ts), which represents the first 5 minutes of video.
At minute 4, the player requests another 10 chunks in advance to buffer the next 5 minutes. However, by that time, the manifest file has expired, and the server returns an HTTP 483 error.
I can detect the error using a custom HttpDataSource or a custom LoadErrorHandlingPolicy, but the challenge is how to switch the stream URL seamlessly without interrupting playback. The goal is for the player to retrieve the new manifest and continue playing the video after minute 5, without the user noticing any interruption.

What I've Tried:
I have a custom HttpDataSource to catch the 483 error, but I'm unsure how to update the stream URL in ExoPlayer without resetting the player or causing playback to stop.

Question:
How can I update the HLS manifest URL in ExoPlayer dynamically when an error like HTTP 483 occurs, without interrupting playback or requiring the user to notice any transition?

Upvotes: 0

Views: 51

Answers (0)

Related Questions