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

How to detect a non-playable media source in exoplayer? #5739

Closed
makazemi opened this issue Apr 7, 2019 · 3 comments
Closed

How to detect a non-playable media source in exoplayer? #5739

makazemi opened this issue Apr 7, 2019 · 3 comments
Assignees

Comments

@makazemi
Copy link

makazemi commented Apr 7, 2019

I use of concatenatingMediaSource for playing a list of video. Some uris aren't media(video or audio) and those are uri of pdf files. I want to detect these mediasource and I change playerview to show a button to open pdf file. In fact this functionality of my application is similar to Udemy app. Should I use onPlayerError callback for detecting or exist another way? Thanks in advance for your help.

@tonihei
Copy link
Collaborator

tonihei commented Apr 8, 2019

We can't reliably detect whether media is playable in advance because our media sources are working under the assumption that we have a valid media file. Also, "non-playable" sources can have different forms - from totally unrelated files (like pdf) to more subtle problems like unsupported codecs or media encoding problems.

However, you can listen to errors to get an indication of that. The problem is that we don't currently mark failed media sources in a special way, so you only get the fatal onPlayerError callback in very last moment when we would actually need to start playback.

Marking as an enhancement to add such a "failed" marker to the Timeline. This allows to detect problems in advance before the playback position reaches the failed source.

Also note that ExtractorMediaSource (or ProgressiveMediaSource) doesn't prepare the media much in advance at the moment which means such a flag will not help a lot for that sources until this situation has been improved. This feature is tracked by #4727.

@makazemi
Copy link
Author

@tonihei : So how did Udemy app implement this feature ? i know, they use exoplayer.

@tonihei
Copy link
Collaborator

tonihei commented Apr 15, 2019

I can't possibly know how their app is implemented and how and if they integrate ExoPlayer. You probably have a better chance of finding that out by asking the developers of this app directly.

@ojw28 ojw28 closed this as completed May 6, 2019
@google google locked and limited conversation to collaborators Sep 27, 2019
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