google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.75k stars 6.03k forks source link

Exoplayer failed to parse url like http://static.myserver.com/?video_id=12312323&ext=.mp4 #4033

Closed Zeus64 closed 6 years ago

Zeus64 commented 6 years ago

Exoplayer failed with an exception to parse url like :

http://static.myserver.com/?video_id=12312323&ext=.mp4

tonihei commented 6 years ago

This url can't be resolved (as easily verified by clicking on above link). That's also why ExoPlayer fails trying to play this url.

If you have any specific concern about the exception, please fill out the issue template and provide all the requested information.

Zeus64 commented 6 years ago

yes this url can't be resolved (i don't have a public url like this one) but the problem is not here. The problem is that exoplayer will try to parse the url in components and try to get the extension of the first component that in this url http://static.myserver.com/?video_id=12312323&ext=.mp4 is null (for example for http://static.myserver.com/toto.mp4 first component = toto.mp4)

AquilesCanta commented 6 years ago

It'd be useful if you described how to trigger the exception, @Zeus64. We have sample content whose last path component does not have an extension, and works correctly. Some modules of exoplayer depend on the content to have an extension. For example, the segments of an HLS media playlist. If your playlist does not include the extension, you'd have to implement your own HlsExtractorFactory. So, as the issue template lists, a logcat would almost certainly be enough for us to tell what the issue is.

Zeus64 commented 6 years ago

@AquilesCanta yes sorry i forget to say it's was with HLS (I don't know why i gave you an exemple with mp4)

correct url is something like http://static.myserver.com/?video_id=12312323&ext=.ts

exception is raise here :

com.google.android.exoplayer2.source.hls ... String lastPathSegment = uri.getLastPathSegment(); if (MimeTypes.TEXT_VTT.equals(format.sampleMimeType) || lastPathSegment.endsWith(WEBVTT_FILE_EXTENSION) || lastPathSegment.endsWith(VTT_FILE_EXTENSION)) {

here lastPathSegment is null and thus doing lastPathSegment.endsWith(WEBVTT_FILE_EXTENSION) raise an exception

but the exception is unecessary because you consider all other format as TS format.

AquilesCanta commented 6 years ago

I will modify the default HLS extractor factory to assume TS when the path is not found. But in this case, you'd be better off creating your own extractor factory that uses the ext GET parameter to determine the extractor. Please fill the issue template next time. It will save everyone some time.

Zeus64 commented 6 years ago

thanks Aquiles, yes sorry it's was late the night and I was tired and I fill the report quite fastly :(