Lines Matching refs:item
35 * Actual playback of a single media item is abstracted into a Player interface,
92 // If player supports queuing, get status of each item. Player is
96 PlaylistItem item = mPlaylist.get(i);
97 mPlayer.getStatus(item, (i == mPlaylist.size() - 1) /* update */);
100 // Otherwise, only need to get status for current item. Player is
118 // append new item with initial status PLAYBACK_STATE_PENDING
119 PlaylistItem item = new PlaylistItem(
121 mPlaylist.add(item);
124 // if player supports queuing, enqueue the item now
126 mPlayer.enqueue(item);
129 return item;
148 PlaylistItem item = getCurrentItem();
149 if (pos != item.getPosition()) {
150 item.setPosition(pos);
151 if (item.getState() == MediaItemStatus.PLAYBACK_STATE_PLAYING
152 || item.getState() == MediaItemStatus.PLAYBACK_STATE_PAUSED) {
153 mPlayer.seek(item);
156 return item;
169 for (PlaylistItem item : mPlaylist) {
170 if (item.getItemId().equals(iid)) {
171 if (item == getCurrentItem()) {
172 mPlayer.getStatus(item, false);
174 return item;
235 // Suspend the playback manager. Put the current item back into PENDING
239 for (PlaylistItem item : mPlaylist) {
240 item.setRemoteItemId(null);
241 item.setDuration(0);
243 PlaylistItem item = getCurrentItem();
245 log("suspend: item=" + item + ", pos=" + pos);
247 if (item != null) {
248 if (item.getState() == MediaItemStatus.PLAYBACK_STATE_PLAYING
249 || item.getState() == MediaItemStatus.PLAYBACK_STATE_PAUSED) {
250 item.setState(MediaItemStatus.PLAYBACK_STATE_PENDING);
251 item.setPosition(pos);
257 // This will resume playback of current item. Furthermore, if the new player
264 for (PlaylistItem item : mPlaylist) {
265 mPlayer.enqueue(item);
318 PlaylistItem item = getCurrentItem();
319 if (item == null || !item.getItemId().equals(iid)) {
320 throw new IllegalArgumentException("Item is not current!");
325 PlaylistItem item = getCurrentItem();
326 if (item != null) {
327 if (item.getState() == MediaItemStatus.PLAYBACK_STATE_PENDING) {
328 item.setState(mPaused ? MediaItemStatus.PLAYBACK_STATE_PAUSED
331 mPlayer.play(item);
333 } else if (mPaused && item.getState() == MediaItemStatus.PLAYBACK_STATE_PLAYING) {
335 item.setState(MediaItemStatus.PLAYBACK_STATE_PAUSED);
336 } else if (!mPaused && item.getState() == MediaItemStatus.PLAYBACK_STATE_PAUSED) {
338 item.setState(MediaItemStatus.PLAYBACK_STATE_PLAYING);
340 // notify client that item playback status has changed
342 mCallback.onItemChanged(item);
353 for (PlaylistItem item : mPlaylist) {
354 if (iid.equals(item.getItemId())) {
356 mPlayer.remove(item.getRemoteItemId());
357 } else if (item.getState() == MediaItemStatus.PLAYBACK_STATE_PLAYING
358 || item.getState() == MediaItemStatus.PLAYBACK_STATE_PAUSED){
361 item.setState(state);
362 found = item;
363 // notify client that item is now removed
368 queue.add(item);
375 log("item not found");
381 PlaylistItem item = getCurrentItem();
382 if (item != null) {
383 removeItem(item.getItemId(), error ?
406 for (PlaylistItem item : mPlaylist) {
407 result += "\n" + item.toString();
417 void onItemChanged(PlaylistItem item);