Exoplayer: ClippingMediaSource in Multiple Player not play correctly

Created on 27 Mar 2019  路  3Comments  路  Source: google/ExoPlayer

Hello,

Content description

I have a list to play and don't wanna have any gapless so I decided to use multiple ExoPlayer to load upcoming items.
My demo have 2 exoPlayer. Everything's ok until I try to use ClippingMediaSource to play a range in item. If second item state is Player.STATE_READY when click next, it just have audio without video, it just show video when click play button on controller or click next when second item in Player.STATE_BUFFERING.
Any suggestions for me? Thank you so much

Version of ExoPlayer being used:

2.9.6

Device(s) and version(s) of Android being used:

ASUS_Z002 - Android 5.0

This is my code:

fun commonSetup() {
        setUpAction()
        dataSourceFactory = DefaultDataSourceFactory(baseContext,
                Util.getUserAgent(baseContext, "DemoEXOPlayer"))

        mediaSource1 = ClippingMediaSource(ExtractorMediaSource.Factory(dataSourceFactory).createMediaSource(uri1), 2000000, 7000000)
        mediaSource2 = ClippingMediaSource(ExtractorMediaSource.Factory(dataSourceFactory).createMediaSource(uri2), 2000000, 7000000)


        mPlayer1 = ExoPlayerFactory.newSimpleInstance(this)
        mPlayer2 = ExoPlayerFactory.newSimpleInstance(this)

        mPlayer1.playWhenReady = true
        mPlayer2.playWhenReady = false

        mPlayer1.addListener(this)
        mPlayer2.addListener(this)


        mPlayer1.prepare(mediaSource1)
        mPlayer2.prepare(mediaSource2)

        playerView.player = mPlayer1
    }


    fun setUpAction() {
        mNext.setOnClickListener {
            playerView.player.stop()
            playerView.player.release()
            playerView.player = mPlayer2
            mPlayer2.playWhenReady = true
        }


    }
question

All 3 comments

May I kindly ask to create a bug report right after you are observing the problem? Without this it's very hard for us to investigate the problem.

In general using two players at the same time requires that the device is capable of providing multiple codec instances. I don't know whether the ASUS_Z002 device can do this. If it can't you would see a stack trace in the logs (it would happen at the moment when you are calling prepare() for both players).

What you are describing (no video, only audio) for the second player may manifest that the device is not capable to provide multiple instance of hardware supported video codec instances while the audio decoder is probable a software decoder where multiple instances are provided.

If you can provide a bug report we could verify that hypothesis.

Thanks for sending this over. I can't find something which indicates codec issues. The logs do not tell much, besides that two instance of the player have been created, like you code suggests.

I'd recommend to use the EventLogger which produces more information in the logs, which allows you to interpret precisely what both of the players are doing and to which states the have at what moment. Without this information it's very hard to tell.

I think it's also worth to refine the application logic a bit. With the current commonSetup it can easily happen, that when the next button (mNext) is pressed twice, both player are stopped and released which could result in confusion. Here the EventLogger would also help to clarify when reading the logs.

Was this page helpful?
0 / 5 - 0 ratings