Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve gapless between two tracks #3206

Closed
mirandole opened this issue Aug 24, 2017 · 4 comments
Closed

Improve gapless between two tracks #3206

mirandole opened this issue Aug 24, 2017 · 4 comments
Assignees
Labels

Comments

@mirandole
Copy link

Hello everyone,

I use Exoplayer-dev-v2.5.0

Following this thread: #1706, I was hoping to obtain gapless audio playing with the new DynamicConcatenatingMediaSource but there is still a small gap between two tracks.

I'm looking at the ExoPlayer code to find a way to avoid the gap between two different tracks. The best will be to avoid discontinuity between two tracks.

I don't know if it's possible, but if there is a gap, my player stream is probably empty at a time when I'm playing from the current track to the next one. I'm looking to find where and why this gap exists and if there is a way to fill this gap with the beginning of my next track.

I would be grateful If someone has a trail to help me on this.

@ojw28
Copy link
Contributor

ojw28 commented Aug 24, 2017

Depending on exactly what type of content you're trying to play, the streams themselves may need to contain gapless metadata for them to be played without gaps. We do not manually detect and clip silence from the start and end of each file; if it's present then it needs to be properly specified by in the metadata. I'm pretty sure use of DynamicConcatenatingMediaSource will get you fully gapless playback when the metadata is present and correct. @andrewlewis can further advise.

@mirandole
Copy link
Author

Indeed DynamicConcatenatingMediaSource is close to gapless but when I try to prepare the next track of my DynamicConcatenatingMediaSource it makes a reading gap so I don't know how can I add the next Track in the DynamicConcatenatingMediaSource and prepare it without getting a gap.
In this case there is a gap when I ask to ExoPlayer to prepare the next mediaSource of my DynamicConcatenatingMediaSource. Have I to concatenate all the playlist before playing it to avoid gap or is it possible to add next track one by one ? Or is it possible to concatenate the next track to and prepare it when the current track is playing without a cut-off?

@tonihei
Copy link
Collaborator

tonihei commented Aug 24, 2017

You don't have to add the entire playlist upfront. That's why it's dynamic - allowing you to add and remove things later on. However, it sounds as if you add the next media source after the first one has already fully played to its end? To be able to pre-buffer the next item without noticeable gaps, you should ensure that you add it at least some time before playback reaches the end of the previous item.

@andrewlewis
Copy link
Collaborator

ExoPlayer supports gapless playback of MP3 files that contain gapless metadata in Xing and ID3 headers, and MP4 files that have udta boxes or edit lists with gapless metadata. If you provide the media you're trying to play, we can check that the required metadata is present.

As Toni points out, it's also necessary to make sure the player has the next MediaSource sufficiently far in advance of playback reaching the end of the current one. It's generally fine to populate the DynamicConcatenatingMediaSource as soon as you know what is going to be played. The player will take care of loading sources at the right time, and you can remove items from the concatenation later on if necessary.

@google google locked and limited conversation to collaborators Feb 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants