Reputation: 95
I need to receive a local host RTSP stream and display it in my jetpack compose android application.
The RTSP stream is being hosted through docker via 'aler9/rtsp-simple-server' , and is tested and functionally up and running.
I have implemented exoplayer correctly but the prepare statement from my Exoplayer isn't really being executed properly. Since I don't receive the call in my docker command line for the ports
Code that is being executed:
// Fetching the Local Context
val mContext = LocalContext.current
// Create a player instance.
var player = ExoPlayer.Builder(mContext).build()
// Set the media item to be played.
val rtspUri = "rtsp://10.0.2.2:8554/test"
var mediaSource = RtspMediaSource.Factory().createMediaSource(MediaItem.fromUri(rtspUri))
player.setMediaSource(mediaSource)
// Prepare the player.
player.prepare()
// player.playWhenReady = true
// Implementing ExoPlayer
AndroidView(factory = { context ->
PlayerView(context).apply {
player = player
}
})
I have also added the internet permission to the AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
What am I doing wrong?
Tried to receive RTSP stream through Exoplayer but the call is never made
Upvotes: 1
Views: 323