access software decoders through exoplayer

197 views Asked by At

I want to access software decoder through exoplayer like when my hardware decoders wont support a video it should work with software decoders. i want them to automaticaly switch whatever works for a video.

    val codecInfo = MediaCodecList(0).findDecoderForFormat(format)
    if (codecInfo == null) {
        val renderersFactory = DefaultRenderersFactory(this)
            renderersFactory.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON)
        player = ExoPlayer.Builder(this,renderersFactory).build()

    }


    player = ExoPlayer.Builder(this).build()
        .also { exoPlayer ->
            viewBinding.videoView.player = exoPlayer
            // Update the track selection parameters to only pick standard definition tracks
            exoPlayer.trackSelectionParameters = exoPlayer.trackSelectionParameters
                .buildUpon()
                .setMaxVideoSizeSd()
                .build()
                   // .setMediaCodecSelector(YourMediaCodecSelector()))
            val mediaItem = MediaItem.Builder()
                .setUri(getString(R.string.media_url_dash))
                .setMimeType(MimeTypes.APPLICATION_AIT)
                .build()
            exoPlayer.setMediaItems(listOf(mediaItem), mediaItemIndex, playbackPosition)
            exoPlayer.playWhenReady = playWhenReady
            exoPlayer.addListener(playbackStateListener)
            exoPlayer.prepare()
        }
}
0

There are 0 answers