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

Is there a way to know if video is playable on ExoPlayer before I call ExoPlayer's prepare function? #4157

Closed
hahafamilia opened this issue Apr 20, 2018 · 1 comment
Assignees
Labels

Comments

@hahafamilia
Copy link

hahafamilia commented Apr 20, 2018

Before filing an issue:

When reporting a bug:

Issue description

Hello.
I'm reviewing ExoPlayer, and maybe what I know

Question 1

I want to play various video codecs, audio codecs, and containers on ExoPlayer.
Some videos are videos not supported by ExoPlayer.
I would like to know in advance whether the video you are trying to play is a video supported by ExoPlayer.
Currently the only way I know of is to handle the onPlayerError event.
However, if I do this, ExoPlayer will be processed after the play.
Is there a way to know if video is playable on ExoPlayer before I call ExoPlayer's prepare function?

Question 2

When ExoPlayer attempts to play,
Exception occurs when codec and container can not play in ExoPlayer.
Also, an Exception occurs when ExoPlayer is able to play but has a temporary error.
Ex) Network state, TimeoutException...

What are Best practices that distinguish this?

The example project distinguishes between unsupported formats.
The example project checks the onTracksChanged event for MappedTrackInfo and identifies it as an unsupported type.
The example project checks the onPlayerError event for ExoPlaybackException.TYPE_RENDER and identifies it as an unsupported type.

I think the matroska extracteor lacing Exception(#3026) is also not playable.
In this case, the ExoPlayerbackExeption's Type is TYPE_SOURCE and a ParserException is thrown.

How can I know if a video can not be played on ExoPlayer and quit the app?
How can I retry playback without shutting down the app when a temporary error occurs?

Reproduction steps

Link to test content

Version of ExoPlayer being used

2.7.3

Device(s) and version(s) of Android being used

A full bug report captured from the device

@tonihei
Copy link
Collaborator

tonihei commented Sep 11, 2018

Sorry for the super-late answer.

  1. The best way to check this is to query the renderer capabilities for the format you mare trying to play. This is more or less a duplicate of Q- Is there a way to know if device can play HD stream without loading player  #4475.

  2. If the format is just not supported, the player will not select the tracks and will only play the remaining tracks without error. If you see an error of TYPE_SOURCE, it's most likely a problem with reading the data or with parsing the data. Especially ParserExceptions mean that your media is faulty (or ExoPlayer doesn't support this type of media). TYPE_RENDERER is used when there was a problem with decoding the media. Could also mean that the media is faulty or that there is a bug in the platform. Please file specific issues with example media if you have a problem like that.

If you want to retry after error, please call player.prepare(mediaSource, false, false) with the same media source. In the next release, there will also be a method player.retry() to do exactly that.

@tonihei tonihei closed this as completed Sep 11, 2018
@google google locked and limited conversation to collaborators Jan 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants