Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch rendition if the rendition which Exoplayer has chosen is not available #2981

Closed
abhishekredspace opened this issue Jun 21, 2017 · 11 comments
Assignees

Comments

@abhishekredspace
Copy link

abhishekredspace commented Jun 21, 2017

I am using Exoplayer 2 in my video player for playback.
When playing HSL streams is it possible to switch rendition if one of the renditions mentioned in m3u8 file is not available.
We receive a master m3u8 file from the server. This has all the available renditions. Sometimes it can happen that one of the renditions is not available and can respond with status code of 500, 501, 502, 503, 400 or 403 and if Exoplayer chooses that rendition to play it throws an error.

What I am trying to achieve here is if one of the rendition is bad rendition and exoplayer is not able to play it, then it should choose the next/other rendition to play which are available but should not throw onPlayerError callback.

I have also looked at #676 where it talks about changing video track selection using TrackSelector and TrackSelection.

I have implemented Exoplayer.EventListener where I listen for

@Override public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
    // Here I get all video formats and text tracks using 
}
@Override public void onPlayerError(ExoPlaybackException e) { handleError(e); }

So when Exoplayer loads and if it picks the rendition which is bad at first place, I get a callback in onPlayerError.
Is it possible for Exoplayer to choose the other rendition if the one it has picked is bad.

@abhishekredspace abhishekredspace changed the title Switch rendition if the one Exoplayer has chosen is not available Switch rendition if the rendition which Exoplayer has chosen is not available Jun 21, 2017
@AquilesCanta
Copy link
Contributor

Is it possible for Exoplayer to choose the other rendition if the one it has picked is bad.

This is already done by ExoPlayer. However some discussion is in order here. The spec says:

If the server wishes to remove an entire presentation, it SHOULD
provide a clear indication to clients that the Playlist file is no
longer available (e.g. with an HTTP 404 or 410 response).

5xx HTTP error codes are reserved for server errors, whereas 404 and 410 explicitly speak about resource changes. If you can use 410 to indicate unavailability, that will make ExoPlayer do exactly what you aim for. If not, we should discuss whether 500 error codes are appropriate. This is because some other users have complained we should not retry if the player gets a 5xx error. E.g: #2844. But I think there are others. Hope this answers your question. Please close if so.

@ojw28 ojw28 added the question label Jun 21, 2017
@abhishekredspace
Copy link
Author

Thanks for your answer and information.

@abhishekredspace
Copy link
Author

I agree that for 5xxx HTTP error codes Exoplayer should not retry but in case there are 5 renditions available and out of these 5 renditions, 3 comes from the same server and 2 comes from some other server. Consider the 3 coming from the same server, that server encountered a problem and now if exoplayer picks any one of them we will receive 5xxx error code and no point in retrying. However the remaining 2 which comes from another server, Exoplayer should try to play them instead of throwing an error. So my point is if we are sure that all the available rendition will throw 5xxx error then only Exoplayer should throw an error otherwise it should try to play the one which is good.

@AquilesCanta
Copy link
Contributor

AquilesCanta commented Jun 22, 2017

Sounds like a good argument. I'll give it a thought and post any updates here.

@abhishekredspace
Copy link
Author

Thanks for giving it a thought. Just to add here AvPlayer in iOS already does this, so this functionality becomes important for us as we are trying to keep the behaviour of both platforms i.e. Android and iOS to be in sync.

@abhishekredspace
Copy link
Author

Hello Exoplayer team,
Any updates on this issue?

Thanks

@AquilesCanta
Copy link
Contributor

Hi, this is still on radar, but we haven't allocated time for it yet, unfortunately. Hopefully we'll get to it soon. Many thanks for your patience!

@ojw28 ojw28 added enhancement and removed question labels Mar 8, 2018
@ojw28
Copy link
Contributor

ojw28 commented Mar 8, 2018

This is tracking enabling blacklisting for response codes other than 404 and 410, I think?

@AquilesCanta
Copy link
Contributor

Correct.

ojw28 pushed a commit that referenced this issue Jul 12, 2018
Issue:#2844
Issue:#3370
Issue:#2981

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204149284
ojw28 pushed a commit that referenced this issue Jul 17, 2018
Issue:#2844
Issue:#2981

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204718939
ojw28 pushed a commit that referenced this issue Aug 6, 2018
Issue:#2844
Issue:#3370
Issue:#2981

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206927295
@AquilesCanta
Copy link
Contributor

Please give the new LoadErrorHandlingPolicy a try and let us know if it suits your needs.

Thanks!

@abhivinny
Copy link

Thanks a lot. I will give it a try.

@google google locked and limited conversation to collaborators Dec 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants