79143833

Date: 2024-10-31 07:55:27
Score: 3.5
Natty:
Report link

I'm facing the same problem,

Probably your stream is MPEG-TS over UDP. Based on this code (for ExoPlayer media2) : ExoPlayer2UdpDemo

I have tried to convert the code to Media3. This is what I have done so far without success:

player = ExoPlayer.Builder(this)
.build()
.apply {

    val factory =
        DataSource.Factory { UdpDataSource(3000, 100000) }
        
    val tsExtractorFactory = ExtractorsFactory {
        arrayOf(
            TsExtractor(TsExtractor.MODE_SINGLE_PMT,
                TimestampAdjuster(0), DefaultTsPayloadReaderFactory()
            )
        )
    }

    val mediaSource: MediaSource = ProgressiveMediaSource.Factory(factory,tsExtractorFactory)
        .createMediaSource(MediaItem.fromUri(Uri.parse("udp://@192.168.11.111:1261")))

    setMediaSource(mediaSource)
    prepare()
    playWhenReady = true
}

val playerView = findViewById<View>(R.id.player_view) as PlayerView
playerView.player = player

I'm not sure if ProgressiveMediaSource is the correct way for this type of stream

Reasons:
  • Blacklisted phrase (1): m facing the same problem
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Me too answer (2.5): I'm facing the same problem
  • Low reputation (1):
Posted by: Alex Seferidis