Baseflow / XamarinMediaManager

Cross platform Xamarin plugin to play and control Audio and Video
https://baseflow.com
MIT License
769 stars 306 forks source link

Crossfade songs #7

Open SimonSimCity opened 8 years ago

SimonSimCity commented 8 years ago

I want to have an option to cross-fade between songs. The current implementation pauses the current playing track and starts the new song. The new implementation should wait until the next song has enough data to start playing (check the buffer of the player) and slightly taking down the volume of the currently playing song while start playing the new song by slightly increasing the volume.

It should be possible to:

Please include this in a test and decide what to do:

Maybe it's worth thinking of opening up for a queue, that should just be an instance implementing IEnumerable. The programmer can decide if he wants to have a simple list like new List<Track>() or a more advanced implementation, including shuffling, repeating, etc - but that's up to the integration then.

SimonSimCity commented 8 years ago

Just found this library for iOS - thought it is worth mentioning: https://github.com/evgenyneu/Cephalopod

modplug commented 8 years ago

Great! Not much code to port as well :) It doesn't support crossfading as far as I can see though.

Can you take a look at the new interface definitions in vNext and come up with a proposed implementation for crossfading support in the IAudioPlayer?

SimonSimCity commented 8 years ago

@modplug I'll take a look at it soon, since our clients already keep asking about this feature.

Do you know how it is on UWP? I just found a sample for gapless playing (https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BackgroundMediaPlayback)

On Android there is an implementation around (http://stackoverflow.com/questions/6661596/audio-crossfading-in-android) but why not switch to ExoMediaPlayer first ..?

modplug commented 8 years ago

I've looked that example and I was thinking of implementing the IMediaQueue using MediaPlaybackList on UWP. For crossfade I think we have to have two players with fade in/out functionallity like the one you posted