0

In my project I use Media3 ExoPlayer to play video.

Problem: the stream I want to play is probably not supported.

Links to some other streams work.

build.gradle.kts:

...
// Media3 ExoPlayer
    implementation("androidx.media3:media3-exoplayer:1.0.1")
    implementation("androidx.media3:media3-exoplayer-dash:1.0.1")
    implementation("androidx.media3:media3-ui:1.0.1")
...

activity_main.xml:

...
    <androidx.media3.ui.PlayerView
        android:id="@+id/player"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintDimensionRatio="16:9"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
...

Code for create MediaSource:

...
val mediaSource = DashMediaSource
        .Factory(DefaultHttpDataSource.Factory())
        .createMediaSource(MediaItem.Builder()
            .setUri(url)
            .setMimeType(MimeTypes.APPLICATION_MPD)
            .build())

exoPlayer = ExoPlayer
        .Builder(context)
        .build()
        .apply{
trackSelectionParameters = trackSelectionParameters
                .buildUpon()
                .setMaxVideoSizeSd()
                .build()
            addAnalyticsListener(EventLogger())
            setMediaSource(mediaSource)
            prepare()
}
binding.player.player = exoPlayer
...

In the rest of the code, I don’t see the point, since other videos are played. Therefore, I apply the problematic video codec from manifest.mpd:

<Representation
          id="f3-v1-x3"
          mimeType="video/webm"
          codecs="av01.0.04M.08"
          width="854"
          height="480"
          frameRate="1000/41"
          sar="1:1"
          startWithSAP="1"
          bandwidth="429310">
      </Representation>

What I see?

  1. The player has audio (due to additional AdaptationSet);

  2. There is no picture in the player.

What I think?

Since other videos with different codecs work fine and based on my observations, namely I looked at what MimeTypes.getVideoMediaMimeType("av01.0.04M.08") would return an empty array, and for some other codecs, it returns a non-empty one.

I believe that the codec is not supported.

Please tell me, if I am not mistaken in my assumption, how can I add support for this codec to exoPlayer?

0 Answers0