MediaItemStatus.java revision 43f79f79a5117550a7dfedf9c65124afd163ea43
1/* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.support.v7.media; 18 19import android.os.Bundle; 20 21/** 22 * Constants for specifying status about a media item as a {@link Bundle}. 23 */ 24public final class MediaItemStatus { 25 private MediaItemStatus() { 26 } 27 28 /** 29 * Status key: Playback state. 30 * <p> 31 * Specifies the playback state of a media item. 32 * </p><p> 33 * Value is one of {@link #PLAYBACK_STATE_QUEUED}, {@link #PLAYBACK_STATE_PLAYING}, 34 * {@link #PLAYBACK_STATE_PAUSED}, {@link #PLAYBACK_STATE_BUFFERING}, 35 * {@link #PLAYBACK_STATE_CANCELED}, or {@link #PLAYBACK_STATE_ERROR}. 36 * </p> 37 */ 38 public static final String KEY_PLAYBACK_STATE = "PLAYBACK_STATE"; 39 40 /** 41 * Playback state: Queued. 42 * <p> 43 * Indicates that the media item is in the queue to be played eventually. 44 * </p> 45 */ 46 public static final int PLAYBACK_STATE_QUEUED = 0; 47 48 /** 49 * Playback state: Playing. 50 * <p> 51 * Indicates that the media item is currently playing. 52 * </p> 53 */ 54 public static final int PLAYBACK_STATE_PLAYING = 1; 55 56 /** 57 * Playback state: Paused. 58 * <p> 59 * Indicates that the media item has been paused. Playback can be 60 * resumed playback by sending {@link MediaControlIntent#ACTION_RESUME}. 61 * </p> 62 */ 63 public static final int PLAYBACK_STATE_PAUSED = 2; 64 65 /** 66 * Playback state: Buffering or seeking to a new position. 67 * <p> 68 * Indicates that the media item has been temporarily interrupted 69 * to fetch more content. Playback will resume automatically 70 * when enough content has been buffered. 71 * </p> 72 */ 73 public static final int PLAYBACK_STATE_BUFFERING = 3; 74 75 /** 76 * Playback state: Stopped. 77 * <p> 78 * Indicates that the media item has been stopped permanently either because 79 * it reached the end of the content or because the user ended playback. 80 * </p><p> 81 * A stopped media item cannot be resumed. To play the content again, the application 82 * must send a new {@link MediaControlIntent#ACTION_PLAY} action to enqueue 83 * a new playback request and obtain a new media item id from that request. 84 * </p> 85 */ 86 public static final int PLAYBACK_STATE_STOPPED = 4; 87 88 /** 89 * Playback state: Canceled. 90 * <p> 91 * Indicates that the media item was canceled permanently. This may 92 * happen because a new media item was queued which caused this media item 93 * to be stopped and removed from the queue. 94 * </p><p> 95 * A canceled media item cannot be resumed. To play the content again, the application 96 * must send a new {@link MediaControlIntent#ACTION_PLAY} action to enqueue 97 * a new playback request and obtain a new media item id from that request. 98 * </p> 99 */ 100 public static final int PLAYBACK_STATE_CANCELED = 5; 101 102 /** 103 * Playback state: Playback halted or aborted due to an error. 104 * <p> 105 * Examples of errors are no network connectivity when attempting to retrieve content 106 * from a server, or expired user credentials when trying to play subscription-based 107 * content. 108 * </p><p> 109 * A media item in the error state cannot be resumed. To play the content again, 110 * the application must send a new {@link MediaControlIntent#ACTION_PLAY} action to enqueue 111 * a new playback request and obtain a new media item id from that request. 112 * </p> 113 */ 114 public static final int PLAYBACK_STATE_ERROR = 6; 115 116 /** 117 * Status key: HTTP status code. 118 * <p> 119 * Specifies the HTTP status code that was encountered when the content 120 * was requested after all redirects were followed. This key only needs to 121 * specified when the content uri uses the HTTP or HTTPS scheme and an error 122 * occurred. This key may be omitted if the content was able to be played 123 * successfully; there is no need to report a 200 (OK) status code. 124 * </p><p> 125 * Value is an integer HTTP status code such as 401 (Unauthorized), 404 (Not Found), 126 * or 500 (Server Error). 127 * </p> 128 */ 129 public static final String KEY_HTTP_STATUS_CODE = "HTTP_STATUS_CODE"; 130} 131