ExoPlayer - play 10 files one after another

后端 未结 5 1439
天命终不由人
天命终不由人 2021-02-03 12:30

I have 10 video i need to play, once one is done, the next one starts to play.

I\'m using Google\'s ExoPlayer, I use the example in the DEMO @ GitHub. I can play 1 video

5条回答
  •  春和景丽
    2021-02-03 13:15

    Use ConcatenatingMediaSource to play files in sequence. For example, for playing 2 media Uris (firstVideoUri and secondVideoUri), use this code:

    MediaSource firstSource =
        new ExtractorMediaSource.Factory(...).createMediaSource(firstVideoUri);
    MediaSource secondSource =
        new ExtractorMediaSource.Factory(...).createMediaSource(secondVideoUri);
    
    ConcatenatingMediaSource concatenatedSource =
        new ConcatenatingMediaSource(firstSourceTwice, secondSource);
    

    And then use concatenatedSource to play media files sequentially.

提交回复
热议问题