ExoPlayer
ExoPlayer copied to clipboard
Change m3u8 url in seek bar.
Hi, What i need to do is have "live" playlist (5 chunks at a time) (which is not live) and adopt timeline to the actual size of that media and when seeking is triggered call different m3u8 list in order to skip some chunks.
My question is how would I approach this. To change duration I can create a new PlayerControl and return different duration, To seek I would need to load new url - which is loaded in the renderer, then added to the player.
Any suggestions? In PlayerControl method seekTo() I would need to call player.stop(); player.loadUrl(); //new url depending on seek time// player.play();
Not sure I understand what you are trying to do. This does not seem HLS compliant
@samek Are you getting your live stream from a CDN that delivers only the last X segments in a playlist, and to seek to a position before that you'll have to request a new playlist with some offset parameter in the HTTP request? That is interesting to me, please post your findings after you've experimented a bit with stop, loadURL etc!
I think you'll have to get the information about the archive window size (how far back in the stream it's possible to seek) from your CDN or origin server, as the information is not available in the m3u8 playlist. Once you have that information you'll be able to calculate the new position or offset in seconds when the user drags the seekbar in the player UI.
Martin,
I know it isn’t but all I wanted was some suggestions on how to achieve this.
On 22 Oct 2014, at 10:55, Martin Bonnin [email protected] wrote:
Not sure I understand what you are trying to do. This does not seem HLS compliant
— Reply to this email directly or view it on GitHub https://github.com/martinbonnin/ExoPlayer/issues/40#issuecomment-60054823.
Christian,
exactly that. I know how to change the duration even if the current playlist is only holding X chunks (in my case 5). This can be done in PlayerControl.java [ getDuration() ]
All I would need somehow is to change URL which is currently playing to be replaced by the seekTo method.
As it seams to me I would need to start completely new player with new renderer ??
On 22 Oct 2014, at 11:53, Per Christian Henden [email protected] wrote:
@samek https://github.com/samek Are you getting your live stream from a CDN that delivers only the last X segments in a playlist, and to seek to a position before that you'll have to request a new playlist with some offset parameter in the HTTP request? That is interesting to me, please post your findings after you've experimented a bit with stop, loadURL etc!
I think you'll have to get the information about the archive window size (how far back in the stream it's possible to seek) from your CDN or origin server, as the information is not available in the m3u8 playlist. Once you have that information you'll be able to calculate the new position or offset in seconds when the user drags the seekbar in the player UI.
— Reply to this email directly or view it on GitHub https://github.com/martinbonnin/ExoPlayer/issues/40#issuecomment-60061109.
Yup, I would do this at the application layer, not in the player. It shouldn't be that complicated. Just factor the code that creates the renderer/player and it should be fine.
Of course it's not 100% optional because you have to restart a thread, reopen the codecs, etc but as long as you don't mind adding a few milliseconds each time you seek, it should work.
What i did right now (in FullPlayerActivity) is when seek is called I releasePlayer(); and call preparePlayer() with different url.
It works but's ugly.
If it ain't broke, don't fix it :)