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

Can't play HLS link #3632

Closed
chillsweet opened this issue Dec 23, 2017 · 9 comments
Closed

Can't play HLS link #3632

chillsweet opened this issue Dec 23, 2017 · 9 comments
Assignees
Labels

Comments

@chillsweet
Copy link

ExoPlayer 2.6.0

Problem is when I play HLS link with HlsMediaSource, it can prepare source by show duration of audio but it won't play when ready.

I'm not quite sure that it's about codec of file that effect to this problem? or something else.

problem link:
"https://live-s2.cocodemy.com/content2/a1.mp3/playlist.m3u8?wmsAuthSign=c2VydmVyX3RpbWU9MTIvMjIvMjAxNyAwOToxNzoyOSBBTSZoYXNoX3ZhbHVlPUd6SnFQQkp0VnBia1FJcVlycGl4K3c9PSZ2YWxpZG1pbnV0ZXM9MTA="

playable link:
"https://live-s2.cocodemy.com/content2/p1.mp4/playlist.m3u8?wmsAuthSign=c2VydmVyX3RpbWU9MTIvMjIvMjAxNyAwNDo0MDowNyBBTSZoYXNoX3ZhbHVlPUJJTW5IaFU1VzhqSkNoa1JSMFVYZUE9PSZ2YWxpZG1pbnV0ZXM9MTA="

sorry for my bad english.

@erdemguven
Copy link
Contributor

Tried on dev branch HEAD, player stays in buffering state, no error log. Link plays fine on QuickTime player.

@ojw28
Copy link
Contributor

ojw28 commented Jan 2, 2018

The issue is that the media segments are mp3 segments, but they're named with a .ts file extension.

  • Changing the segment file extensions to .mp3 on the serving side (and updating the media playlist accordingly) will allow the content to be played successfully. If you control the serving side then this is by far the best way for you to resolve the issue, since the file extensions are incorrect.
  • Using a custom HlsExtractorFactory that forces initialization of an Mp3Extractor would also allow the content to be played successfully, if you knew you were handling this type of content. You'd need to pass your custom factory when creating the HlsMediaSource.
  • The fact we rely on the segment file extensions is considered a bug. This issue is tracked by Add support for container format sniffing in HLS #2025.

The only remaining thing here is that now we've made TsExtractor robust against malformed content, this case results in indefinite buffering rather than playback failure. It feels like we should fail eventually (e.g. If we've read a certain number of bytes without ever having encountered a valid TS packet. @AquilesCanta - Could we do something like that to ensure playback failure in this case?

@chillsweet
Copy link
Author

@ojw28 thank you for your solution
I think choice 2 is the best solution now
but I can't find any example code for implement HlsExtractorFactory.

Could you please give me an example about HlsExtractorFactory, so I can use it to finish my HlsMediaSource.

@tonihei
Copy link
Collaborator

tonihei commented Jan 4, 2018

Did you have a look at the interface here: HlsExtractorFactory
And our default implementation: DefaultHlsExtractorFactory.

You can provide your own implementation that forces the initialization of an Mp3Extractor as @ojw28 explained. To use this custom extractor factory, you'll also need to enable it by calling .setExtractorFactroy on the HlsMediaSource.Factory which creates your media source.

@chillsweet
Copy link
Author

@tonihei
I follow your suggestion and now I can play the mp3 link
Thank you so much 👍

@tonihei tonihei closed this as completed Jan 4, 2018
@ojw28
Copy link
Contributor

ojw28 commented Jan 4, 2018

Issue needs to remain open to track this:

The only remaining thing here is that now we've made TsExtractor robust against malformed content, this case results in indefinite buffering rather than playback failure. It feels like we should fail eventually (e.g. If we've read a certain number of bytes without ever having encountered a valid TS packet. @AquilesCanta - Could we do something like that to ensure playback failure in this case?

@ojw28 ojw28 reopened this Jan 4, 2018
@AquilesCanta
Copy link
Contributor

We can count the number of bytes read since the last successful sync, and throw if larger than a given threshold. A fix along these lines will be pushed soon. Thanks for your patience!

ojw28 pushed a commit that referenced this issue Jan 23, 2018
Issue:#3632

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182202289
@ojw28 ojw28 closed this as completed Jan 23, 2018
@ojw28
Copy link
Contributor

ojw28 commented Apr 16, 2018

Please file a new issue, rather than tacking something onto a possibly unrelated issue from months ago. Deleting posts so this issue remains easy to read. Thanks!

@google google deleted a comment from giladna Apr 16, 2018
@google google deleted a comment from giladna Apr 16, 2018
@google google locked and limited conversation to collaborators Apr 16, 2018
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

5 participants