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

Support crossfading between media items/sources #3438

Closed
matt4pi opened this issue Nov 8, 2017 · 17 comments
Closed

Support crossfading between media items/sources #3438

matt4pi opened this issue Nov 8, 2017 · 17 comments
Assignees

Comments

@matt4pi
Copy link

matt4pi commented Nov 8, 2017

It would be nice to be able to transition between MediaSource's with some sort of fade, as opposed the the current hard cut-over.

@ncapdevi
Copy link

This would definitely be great to have. I could look into creating a PR for the matter. @ojw28 Do you have any ideas on where this would live/how this would best be implemented?

@ojw28
Copy link
Contributor

ojw28 commented Jan 2, 2018

I can't think of an easy way of implementing this given the current architecture (i.e. I think it would require some major surgery). Sorry I can't be more helpful. @andrewlewis - Any ideas?

@ojw28 ojw28 assigned andrewlewis and unassigned ojw28 Jan 2, 2018
@andrewlewis
Copy link
Collaborator

No ideas for an easy fix I'm afraid.

@arazabishov
Copy link

@ojw28 and @andrewlewis, if it is possible to implement it in the context of the current architecture, where would you start?

@andrewlewis
Copy link
Collaborator

@tonihei and I discussed this a bit. I think the conclusion was that it would be quite a lot of work and involve at least minor modifications in the player (or major modifications to do it in an elegant way). It would probably be possible to hack something together by adding support for multiple concurrent audio renderers, a custom AudioProcessor that can mix audio from two sources, a custom audio renderer with an AudioSink to write to the mixer, and merging/clipping/concatenation to overlap the streams, but this is going to give a messy player Timeline (rather than a nice clean concatenation) and won't be general purpose, so I'd advise against it.

@AndroidDeveloperLB
Copy link

Can you please add the same about video?

Could be useful for both when you play a new video, and for when you loop on a single video (because sometimes the end of the video doesn't look the same as the start of it).

@kgrevehagen
Copy link

@andrewlewis, I would also love to get this feature, both crossfade between media sources and fade in/out when play/pause is initiated.

I understand that this is not something you're working on at the moment, but I was wondering if you eventually are going to support it or if we need to implement it ourselves.

I'm also happy to help if you need some input from a user of the library.

Thanks in advance!

@elvirturan
Copy link

Crossfade between media sources in ConcatenatingMediaSource you can implement on your own, with method onPositionDiscontinuity and (reason == Player.DISCONTINUITY_REASON_PERIOD_TRANSITION || reason == Player.DISCONTINUITY_REASON_SEEK) you are getting info when track is changed, so then just get track duration and 10s (or whatever) before end with ''post delayed'' call another method (in new thread, so for loop can call thread sleep in each loop) for fade out (setting player volume decreasing) and after that call player.next() to play next song in playlist and then you can do fade in inside (playbackState == PlaybackStateCompat.STATE_PLAYING).

@cdarau
Copy link

cdarau commented Nov 5, 2019

@elvirturan cross-fade means that the track that's ending is fading out simultaneously with the fading in of the track that's beginning, not sequentially

@elvirturan
Copy link

@elvirturan cross-fade means that the track that's ending is fading out simultaneously with the fading in of the track that's beginning, not sequentially

Yes i know, but it is my temporary solution until will Exo support cross-fade

@adoudech
Copy link

adoudech commented Mar 1, 2021

Does Exoplayer support the cross-fade feature in the latest versions? Thank you

@andrewlewis
Copy link
Collaborator

This is still not supported I'm afraid. If/when we get round to it this issue should get updated.

@andrewlewis andrewlewis changed the title Support fading between sources in ConcatenatingMediaSource Support fading between media items/sources Mar 24, 2021
@andrewlewis andrewlewis changed the title Support fading between media items/sources Support crossfading between media items/sources Mar 24, 2021
@Romantic-LiXuefeng
Copy link

Add this feature, it will easy to used for video edit apps. I find that ExoPlayer is being to support to re-encode and re-mux the file format. Is there any plan to do the support for video edit?

@ShaoWeiguo
Copy link

We want to implement the crossfading between media items/sources, fading in at each media items/sources and fading out at each media items/sources. The purpose is make audio bitrate/codec switching seamless.
Based on the latest version (v2.15.1), could you give us the suggestion how to implement this feature?

@krocard
Copy link
Contributor

krocard commented Nov 16, 2021

Fade-out and fade-in could be implemented in a very similar manner to how gapless is currently implemented. Instead of trimming the beginning and end of the track a FadeAudioProcessor would fade it in and out.

The main issue with Cross-fade is the audio contraction and player position. For example how to crossfade 2 media with video tracks? Should the video also crossfade/fade to black? This is far from supported in ExoPlayer. Similarly, which song cover should the UI display during the crossfade? Technically both tracks are playing at the same time during the crossfade.

Cross-fade could be implemented similarly to Fade-out/in, but would mix the end buffer with the beginning buffer of the next track. One consequence of this design is that the player position during the crossfade would be the beginning of the next track. Aka the player position will jump over the end of the track to the next track when the crossfade would start. It would not be possible for the position to switch media at the middle of the crossfade, only at the beginning.

@nowfalsalahudeen
Copy link

is there any way to implement gl-transitions between two video inputs in exoplayer. same like ffmpeg gl- transition

@tonihei
Copy link
Collaborator

tonihei commented Jun 24, 2024

I'll mark this issue as a duplicate of androidx/media#2 to use the newer one for future tracking.

@tonihei tonihei closed this as completed Jun 24, 2024
@google google locked and limited conversation to collaborators Aug 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests