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

Add method getQueueItems() in CastPlayer class [New Feature] #4474

Closed
mrHerintsoaHasina opened this issue Jul 5, 2018 · 4 comments
Closed
Assignees
Labels

Comments

@mrHerintsoaHasina
Copy link

Hi, it would be useful if the CastPlayer class has a method getQueueItems() as following :

  /**
   * Returns the list of MediaQueueItem as an unmodifiable list
   * @return The list of MediaQueueItem, or null if no cast session
   */
  public List<MediaQueueItem> getQueueItems() {
    return isCastSessionAvailable() ? remoteMediaClient.getMediaStatus().getQueueItems() : null;
  }

@tonihei
Copy link
Collaborator

tonihei commented Jul 5, 2018

Please have a look at CastPlayer.getItem(periodId). I think that should allow you to query all available queue items.

@tonihei tonihei self-assigned this Jul 5, 2018
@mrHerintsoaHasina
Copy link
Author

But how can we get the periodId of all the available queue items from the CastPlayer ?

@tonihei
Copy link
Collaborator

tonihei commented Jul 5, 2018

You can query the current timeline with castPlayer.getCurrentTimeline() or listen to updates with a Player.EventListener and wait for onTimelineChanged(...).
In this timeline, you'll find as many periods as queue items. Check out timeline.getPeriodCount() and timeline.getPeriod(periodIndex, new Period()). The latter method gives you a Period object with further information about the period. period.id is the one you are looking for.

@mrHerintsoaHasina
Copy link
Author

Thanks ! It is worked.

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