react-native-track-player icon indicating copy to clipboard operation
react-native-track-player copied to clipboard

[Feature Request] autodetect HLS & Dash

Open jspizziri opened this issue 1 year ago • 3 comments

What is the need and use case of this feature?

Currently you have to manually pass a type on android if you're using HLS or Dash. I think this should be enhanced such that default will attempt to auto-detect it for you based on the extension of the URL (.m3u8 -> hls, .mpd -> dash).

jspizziri avatar Nov 20 '24 21:11 jspizziri

Looking at https://developer.android.com/media/media3/exoplayer/hls#using-mediaitem, exoplayer can also autodetect these based on the url.

See their example code:

// Create a player instance.
val player = ExoPlayer.Builder(context).build()
// Set the media item to be played.
player.setMediaItem(MediaItem.fromUri(hlsUri))
// Prepare the player.
player.prepare()

Perhaps we need to use MediaItem.fromUri(src)?

Same goes for DASH: https://developer.android.com/media/media3/exoplayer/dash#using-mediaitem

puckey avatar Sep 23 '25 14:09 puckey

@jspizziri do you want to give this pr a try: https://github.com/doublesymmetry/react-native-track-player/pull/2525/files

puckey avatar Sep 23 '25 15:09 puckey

@puckey I'll give it a try and let you know.

jspizziri avatar Sep 23 '25 15:09 jspizziri