Open w3woody opened 2 months ago
Sample application which can reproduce the issue (consisting of one .java file that kicks off the player) attached.
To test, compile and run. You can see the failure by uncommenting line 34 in VideoActivity.java; you can see it work successfully by commenting out line 34 and uncommenting line 33.
but it seems ExoPlayer should be able to do this 'automagically.'
This isn't the case I'm afraid. Setting the mime type in the media item should do the trick.
Please see the docs around non-standard file extensions: https://developer.android.com/media/media3/exoplayer/media-items#handling-non-standard
Version
Media3 1.4.1
More version details
I have also been able to reproduce this on the current 'main' branch.
Devices that reproduce the issue
Google Pixel 5 running Android Version 14.
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
No
Reproduction steps
Create a new video player. Attempt to play a video from
https://c1m.co/test.php
(this is my personal test server, and I'll leave the file up). The file will return a 302 forward request tohttps://test-streams.mux.dev/tos_ismc/main.m3u8
Playback will fail with an error "ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED"If you replace the URL with the final destination (
https://test-streams.mux.dev/tos_ismc/main.m3u8
), the video will play back just fine.Discussion
I spent some time going through the ExoPlayer code. It appears what is happening is that after the forwarding is followed DefaultHttpDataSource, the original URL is used (
...test.php
) to determine the file type of the video file to play back. As it does not end withm3u8
, ExoPlayer decides it must be a movie and attempts to read the binary header to determine the type of payback file.Further, the ExoPlayer code appears to discard (or never use) the mime type returned with the forwarded file.
I have been able to work around this issue by creating a helper class that does a 'HEAD' request to get the final destination after 301/302 forwarding, as well as the returned mime type, but it seems ExoPlayer should be able to do this 'automagically.'
Expected result
The video at the URL forwarded from 'https://c1m.co/test.php' be identified correctly and played properly if it is an .m3u8 file.
Actual result
Playback will fail with an error "ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED"
Media
https://c1m.co/test.php
Bug Report
adb bugreport
to android-media-github@google.com after filing this issue.