-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Update shuffle order in unprepared ConcatenatingMediaSource. #4915
Comments
Could you please be a little more specific about what you are doing exactly? For example, provide a minimal example of what you do to make the problem occurs. |
Yes sure i will explain. I have a list of 5 songs, lets say List A - song1, song2, song3, song4, song5. Now I have shuffled the list and assgined it to shuffled list lets say List S - - song5, song3, song4, song1, song2. Now after updating the media source list, It should be the song3 from the sequence of List S |
Did you call player.prepare(listS) to actually start playing the new media source. Or how do you switch from one to the other? Generally, you should try to use |
At the time of shuffling, one song is already playing so i want to change the media source position while the current keeps playing and position of all the songs needs to be change. Yes I have also used |
If you set |
Okay, But i also want to show the shuffled list in the recyclerview which shows the list of songs. Will get the shuffled list of urls go change the order of list in recyclerview also? |
And also i dont think it will be possible cause we are trying to achieve the shuffle functionality same as Google Play app. To shuffle the song before playing the list so user can actually see the the shuffled list also. |
You can query the order by getting the timeline with |
And if you want to shuffle yourself in advance and specifically set the shuffle order (instead of using a random one), you can use |
Okay. Let me try that, I will update here. |
Hi, There is not such method in class ConcatenatingMediaSource.java |
It was added in 2.9.0. So maybe you need to update. Looking more closely, it may also be quite difficult to provide the initial order because the ShuffleOrder class wasn't written with that use in mind. To simplify this, we should probably do the following:
If we implement step 1 at least, you can do the following: |
Though I have also found one more issue. When i add media source at same position using, And I have 10 song in list and i shuffled and re-shuffled it 10 times so after that my media sources size reaches to 100+. |
addMediaSource actually adds the media source and does not replace it.
…On Fri, 5 Oct 2018, 19:34 HardikChauhanSA, ***@***.***> wrote:
Though I have also found one more issue.
When i add media source at same position using,
cMediaSource?.addMediaSource(i, hlsMediaSource)
And i already has one media source, this is keep adding the new media
sources and the size of media sources gets increased.
I have 10 song in list and i shuffled and re-shuffled it 10 times so after
that my media sources size reaches to 100+.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#4915 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZpsYj-8PL3HJhbogzWTUjtQ1wz_VpQYks5uh6YYgaJpZM4XJ-I8>
.
|
okay. Is there any way to just replace the media source at specific index? |
You can just call removeMediaSource(i) and addMediaSource (i, newSource) to
replace the item at position i.
…On Fri, 5 Oct 2018, 20:23 HardikChauhanSA, ***@***.***> wrote:
okay. Is there any way to just replace the media source at specific index?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#4915 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZpsYg21sSCYjbKX0m_-XtiEePASK_Teks5uh7GkgaJpZM4XJ-I8>
.
|
Hello, I have tried with the above solution, I am able to get some things fixed but found one more thing, How can i get the index of currently playing media source? |
player?.currentWindowIndex is the correct approach. If it returns 0, you
are probably still playing the first item in the list or you haven't
started playback yet.
…On Sat, 6 Oct 2018, 10:16 HardikChauhanSA, ***@***.***> wrote:
Hello,
I have tried with the above solution, I am able to get some things fixed
but found one more thing,
player?.currentWindowIndex!! exoplayer always returns 0.
How can i get the index of currently playing media source?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#4915 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZpsYkpZcewucgO9pBmsdLM-RHpIRnMoks5uiHTSgaJpZM4XJ-I8>
.
|
…orders Issue: #4915 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=221075615
What's the status of this issue? |
The commit above addressed point 2, but point 1 still needs to be done. |
Hello, I have a question related to this topic. I have implemented ExoPlayer with |
@kraizman The window index is still 0 while the timeline is still Timeline.EMPTY. It should be available with the first onTimelineChanged event. This is also similar to the comment I made here about the tag of the current window. I've opened #5155 to track this, but it's probably low priority for now. |
For player app this is crushual as you need to display which song is buffering. In case source is from internet it may take significant time to get it ready. So there will be no way to show what is going on to user. |
@kraizman As said above, you don't need to wait until the state is READY. The timeline (and the shuffled order) is available as soon as the first onTimelineChanged event arrives. This should happen within milliseconds after calling prepare. |
Oh, I didn't understand it this way. I will check this. Thanks for clarifications |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…orders Issue: #4915 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=221075615
setShuffleOrder is now part of player API and can be called at any time. |
Hello,
I have been implementing a shuffle feature for medial player app.
Recently i have found an issue like,
I have list A of a song and added it to media source.
Now i have shuffled list B and updated my media source according to the shuffled list.
The issue is after allocating new media source from shuffled list and when i play next song,
the next song is playing as per the sequence of list A.
After than click on next again it plays the song as per sequence of list B.
It seems that ExoPlayer is storing the next media source and playing that even after i have updated the media sources.
Please check and let me know how can i address this issue.
Thanks.
The text was updated successfully, but these errors were encountered: