Open tamanna-seg opened 3 years ago
@christosts @marcbaechinger is this can be possible or not with Exo player?
You should be able to instantiate a media source to an audio file and then use a number of ClippingMeidaSource
s to wrap them. Then use a MerginMediaSource
to merge the clipping media sources together and call for instance exoPlayer.setMediaSource(mergingMediaSource)
.
You would then need to select the track that you want to play with the TrackSelector
. If you are using the EventLogger
it should be easy to see the tracks in the log.
If that isn't what you were asking, then can you please clarify your question a bit?
With Clipped media source, media source played between start and end time and when I merged multiple clipped source to Merged Media source all source are played from 0 position but I want to play sources to start also from different timestamps.
Code snippet is:
ClippingMediaSource videoSource0 = new ClippingMediaSource(mediaSource1, 0, 2000000,true,true,false);
ClippingMediaSource videoSource1 = new ClippingMediaSource(mediaSource2, 2000000, 5000000,true,true,false);
ClippingMediaSource videoSource2 = new ClippingMediaSource(mediaSource3, 7000000, 10000000,true,true,false);
ClippingMediaSource videoSource3 = new ClippingMediaSource(mediaSource4, 1200000, 13000000,true,true,false);
mergingMediaSource = new MergingMediaSource(true,false,videoSource0, videoSource1,videoSource2,videoSource3);
player.prepare(mergingMediaSource,true,false);
In this clipped sources are clipped but all 4 sources played together i.e. from 0 position.
I'm not sure I understand what you mean with I want to play sources to start also from different timestamps
. I thought that is why you wrap the source with a ClippingMediaSource
. Once they are merged in a MergingMediaSource
the source is played from position 0 of the merging media source. Position 0 of the merging media source is then mapped to position 0 of the clipped media sources that are clipped to the corresponding position according to the clipping properties.
So in you example, position 0 of the merging source is 0, 2000000, 7000000, 1200000 of the merged sources respectively.
Please note that by default a player has only a single audio renderer. Which means you can only play one audio source at the same time. The player does not mix these sources together or the like. You need to select one of the audio sources to be rendered by the single audio renderer instance. If you want to play more than a single audio stream at once you need to setup the player accordingly with multiple audio renderes which is non-trivial. If you want to look into this, you may want to check issues #6589 or #4261 which explains this in more detail.
Unfortunately we can't answer all questions. Unclear questions or questions with insufficient information may not get attention.
Before filing a question:
When filing a question:
Describe your question in detail.
In case your question refers to a problem you are seeing in your app:
$ adb bugreport
in the consoleIn case your question is related to a piece of media:
Don't forget to check supported formats and devices (https://exoplayer.dev/supported-formats.html).
If there's something you don't want to post publicly, please submit the issue, then email the link/bug report to dev.exoplayer@gmail.com using a subject in the format "Issue #1234", where #1234 is your issue number (we don't reply to emails).