-
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
Why we have always the value of castPlayer.getCurrentTimeline().getWindowCount() <= 3 ? #4964
Comments
I hit this same issue. It looks like the timeline under the I came up with (sad but serviceable) workarounds for my two use cases for
Here are my workarounds: When the client is available, you can get the // NOTE: in real code you'll need to check for nulls along this chain of methods
sessionManager.getCurrentCastSession().getRemoteMediaClient().getMediaQueue()
sessionManager.getCurrentCastSession().getRemoteMediaClient().getCurrentItem() For int getCurrentWindowIndex() {
MediaQueue queue = getMediaQueue();
MediaQueueItem current = getCurrentMediaQueueItem();
if (queue == null || current == null) {
index = /** ... my best guess... **/;
}
int itemId = current.getItemId();
int index = queue.indexOfItemWithId(itemId);
if (index == -1) {
index = /** ... my best guess... **/;
}
return index;
} For void seekTo(int windowIndex, long offsetMs) {
MediaQueueItem[] items = /** ... the full queue of items ... **/;
player.loadItems(items, windowIndex, offsetMs, Player.REPEAT_MODE_OFF);
} |
Hi, I apologize for not looking into the reported issues in time. Right now our efforts are focused on writing our own receiver app which will solve most of the current CastPlayer shortcomings. Thanks for your patience! |
I had the same problem with that and some method like getDuration() doesn't work for window number greater that 1 because out of array boundary. I have figured out that Timeline contains info about current Window, previous and the next - so 3 Windows like in the issue title. It can be 2 when it is first or last Window. public Window getWindow(
int windowIndex, Window window, boolean setTag, long defaultPositionProjectionUs) {
if (windowIndex > 0)
windowIndex = durationsUs.length - 1;
if (durationsUs.length == 3)
windowIndex = 1;
//rest of the method |
I found this in the documentation of the Javascript SDK: https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.QueueManager#setQueueStatusLimit When you have a custom receiver app you can remove the limit from the queue. This fixed seeking for me. |
Recently @ojw28 found this in the cast release notes:
Sorry for not providing better support around this. We are actively working on it. |
I will migrate CastPlayer to depend on MediaQueue instead of MediaStatus#getQueueItems. Since this change was announced in April 2018, i think the behavior changed after the Cast extension release. |
Internal ref: b/74587087 |
Issue:#4964 PiperOrigin-RevId: 241311763
Can this be marked as fixed in |
Hi all, please try the fix referenced above and post here if you can still reproduce the issue. I'll be closing as fixed for now. |
Hi,
I've tried to use the MediaSession extension and the Cast Extension together with the
CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID
from the packagecom.google.android.gms.cast
as the receiver application id. I notice strange behaviour with the methodcastPlayer.getCurrentTimeline().getWindowCount()
which returns always a value less or equal than 3, even if I have a long playlist.The problem is in the
TimelineQueueNavigator.onSkipToQueueItem
. If the param id of this method is great than 3, soplayer.seekTo
is not called.The text was updated successfully, but these errors were encountered: