HLS: Live TV Fails to Play [com.google.android.exoplayer2.ParserException: Cannot find sync byte. Most likely not a Transport Stream.]
See original GitHub issuePlaylist URL [https://t1.tvmak.com/tv/TVSHENJA.m3u8?aBtVmfe1F7]
You can see that HLS.js library is playing this playlist very well on “https://tvmak.com/tvshenja” while ExoPlayer, throws exception.
Is there any other way to load this kind of Playlist or … ?
fun createMediaSource(
context: Context,
uri: Uri,
headers: Map<String, String>? = null
): MediaSource {
val dataSource = buildDataSourceFactory(context, headers)
val factory = buildMediaSourceFactory(dataSource, uri)
return factory.createMediaSource(uri)
}
private fun buildDataSourceFactory(
context: Context,
headers: Map<String, String>?,
): () -> DefaultDataSource {
return {
val defaultHttpDataSource = DefaultHttpDataSource(USER_AGENT)
headers?.let {
for (h in it)
defaultHttpDataSource.setRequestProperty(h.key, h.value)
}
DefaultDataSource(context, defaultHttpDataSource)
}
}
private fun buildMediaSourceFactory(
factory: DataSource.Factory,
uri: Uri
): MediaSourceFactory {
return when (val type = Util.inferContentType(uri)) {
C.TYPE_SS -> SsMediaSource.Factory(factory)
C.TYPE_DASH -> DashMediaSource.Factory(factory)
C.TYPE_HLS -> HlsMediaSource.Factory(factory)
C.TYPE_OTHER -> ProgressiveMediaSource.Factory(factory)
else -> throw IllegalStateException("Unsupported type: $type");
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Cannot find sync byte. Most likely not a Transport Stream #8471
3 (and set the user-agent as instructed), the player fails to parse the incoming data: com.google.android.exoplayer2.source.
Read more >Cannot find sync byte m3u8 on ExoPlayer2 - Stack Overflow
Local Xampp server. The playlist works on HTML5 web player. Then I tried to play the m3u8 file in a Android app. I...
Read more >Troubleshooting - ExoPlayer
The most common cause is that you're trying to play DASH (mpd), HLS (m3u8) or SmoothStreaming (ism, isml) content, but the player tries...
Read more >Free Automated Malware Analysis Service - powered by Falcon ...
Submit malware for free analysis with Falcon Sandbox and Hybrid Analysis technology. Hybrid Analysis develops and licenses analysis tools to fight malware.
Read more >RELEASENOTES.md - google/ExoPlayer - Sourcegraph
will prefer audio tracks whose channel count does not exceed the device ... Fix audio underruns between ad periods in live HLS SSAI...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry but I get the same error with the new file. Can you send an example stream directly by email as indicated in my previous comment?
I get an error ERR_CONNECTION_REFUSED when trying to open the link. Could you please fix this or send the HLS manifest directly? If you’re unable to share the test content publicly, please send it to dev.exoplayer@gmail.com using subject “Issue #7876”. Please also update this issue to indicate you’ve done this.
Something you can do to see if the error comes from your code is to try to play the file using our demo app. If it plays with the demo app, this probably means that there is an error in the way you configured the player.