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

getCurrentWindow() for CastPlayer gives always 1 #5955

Closed
mkaflowski opened this issue May 27, 2019 · 2 comments
Closed

getCurrentWindow() for CastPlayer gives always 1 #5955

mkaflowski opened this issue May 27, 2019 · 2 comments
Assignees
Labels

Comments

@mkaflowski
Copy link

mkaflowski commented May 27, 2019

When I use CastPlayer with multiple sources, seek track and the track finishes for every next track getCurrentWindow() gives 1.

I believe that remoteMediaClient.getMediaStatus().getIndexById() gives wrong results.
I can get the right result by:
Arrays.binarySearch(remoteMediaClient.getMediaQueue().getItemIds(),remoteMediaClient.getMediaStatus().getCurrentItemId() )

Changing the method fetchCurrentWindowIndex() works for me:

private int fetchCurrentWindowIndex(@Nullable MediaStatus mediaStatus) {
        Integer currentItemId = mediaStatus != null
                ? Arrays.binarySearch(remoteMediaClient.getMediaQueue().getItemIds(),remoteMediaClient.getMediaStatus().getCurrentItemId() ) : null;
        return currentItemId != null ? currentItemId : -1;
    }

It can be the bug in MediaStatus from com.google.android.gms.cast.

mkaflowski added a commit to mkaflowski/HybridMediaPlayer that referenced this issue May 28, 2019
@AquilesCanta AquilesCanta self-assigned this May 28, 2019
@AquilesCanta
Copy link
Contributor

This is another manifestation of #4964. A fix will be referenced below this comment soon.

ojw28 pushed a commit that referenced this issue Jun 6, 2019
ojw28 pushed a commit that referenced this issue Jun 7, 2019
@AquilesCanta
Copy link
Contributor

This should be fixed in the dev branch. Please try it out, and let me know if you encounter any issues.

@google google locked and limited conversation to collaborators Oct 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants