Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ExoPlayer : Does it solve gapless / seamless playback issue that is broken for the Android Media Player

Has anyone tried using ExoPlayer to achieve this? I tried looking online with no success.

When I say gapless playback, I am referring to the problem of using the media player to play local videos back to back. After the first video is done playing, there is a noticeable delay of 1 second before the second video starts.

Hoping this question helps in understanding this issue further. For reference please look at the following question:

Android: MediaPlayer gapless or seamless Video Playing

like image 991
LostPuppy Avatar asked Aug 07 '15 00:08

LostPuppy


People also ask

What is ExoPlayer in Android?

ExoPlayer is an app-level media player built on top of low-level media APIs in Android. It is an open source project used by Google apps, including YouTube and Google TV. ExoPlayer is highly customizable and extensible, making it capable of many advanced use cases.


1 Answers

ExoPlayer 2, which is now officially released, seems to support gapless playback using the ConcatenatingMediaSource class. From its developer guide:

Transitions between sources are seamless. There is no requirement that the sources being concatenated are of the same format (e.g. it’s fine to concatenate a video file containing 480p H264 with one that contains 720p VP9). The sources may even be of different types (e.g. it’s fine to concatenate a video with an audio only stream).

And the example code:

MediaSource firstSource = new ExtractorMediaSource(firstVideoUri, ...); MediaSource secondSource = new ExtractorMediaSource(secondVideoUri, ...); // Plays the first video, then the second video. ConcatenatingMediaSource concatenatedSource =     new ConcatenatingMediaSource(firstSource, secondSource); 
like image 139
shadowmatter Avatar answered Oct 09 '22 21:10

shadowmatter