MediaControlIntent.java revision fb75232cb13b19004ec1189888b46767db20daf4
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.app.PendingIntent;
20import android.content.Intent;
21import android.net.Uri;
22
23/**
24 * Constants for media control intents.
25 * <p>
26 * This class declares a set of standard media control intent categories and actions that
27 * applications can use to identify the capabilities of media routes and control them.
28 * </p>
29 *
30 * <h3>Media control intent categories</h3>
31 * <p>
32 * Media control intent categories specify means by which applications can
33 * send media to the destination of a media route.  Categories are sometimes referred
34 * to as describing "types" or "kinds" of routes.
35 * </p><p>
36 * For example, if a route supports the {@link #CATEGORY_REMOTE_PLAYBACK remote playback category},
37 * then an application can ask it to play media remotely by sending a {@link #ACTION_PLAY play}
38 * intent with the Uri of the media content to play.  Such a route may then be referred to as
39 * a "remote playback route" because it supports remote playback requests.  It is common
40 * for a route to support multiple categories of requests at the same time, such as
41 * live audio and live video.
42 * </p><p>
43 * The following standard route categories are defined.
44 * </p><ul>
45 * <li>{@link #CATEGORY_LIVE_AUDIO Live audio}: The route supports streaming live audio
46 * from the device to the destination.  Live audio routes include local speakers
47 * and Bluetooth headsets.
48 * <li>{@link #CATEGORY_LIVE_VIDEO Live video}: The route supports streaming live video
49 * from the device to the destination.  Live video routes include local displays
50 * and wireless displays that support mirroring and
51 * {@link android.app.Presentation presentations}.  Live video routes typically also
52 * support live audio capabilities.
53 * <li>{@link #CATEGORY_REMOTE_PLAYBACK Remote playback}: The route supports sending
54 * remote playback requests for media content to the destination.  The content to be
55 * played is identified by a Uri and mime-type.
56 * </ul><p>
57 * Media route providers may define custom media control intent categories of their own in
58 * addition to the standard ones.  Custom categories can be used to provide a variety
59 * of features to applications that recognize and know how to use them.  For example,
60 * a media route provider might define a custom category to indicate that its routes
61 * support a special device-specific control interface in addition to other
62 * standard features.
63 * </p><p>
64 * Applications can determine which categories a route supports by using the
65 * {@link MediaRouter.RouteInfo#supportsControlCategory MediaRouter.RouteInfo.supportsControlCategory}
66 * or {@link MediaRouter.RouteInfo#getControlFilters MediaRouter.RouteInfo.getControlFilters}
67 * methods.  Applications can also specify the types of routes that they want to use by
68 * creating {@link MediaRouteSelector media route selectors} that contain the desired
69 * categories and are used to filter routes in several parts of the media router API.
70 * </p>
71 *
72 * <h3>Media control intent actions</h3>
73 * <p>
74 * Media control intent actions specify particular functions that applications
75 * can ask the destination of a media route to perform.  Media route control requests
76 * take the form of intents in a similar manner to other intents used to start activities
77 * or send broadcasts.  The difference is that media control intents are directed to
78 * routes rather than activity or broadcast receiver components.
79 * </p><p>
80 * Each media route control intent specifies an action, a category and some number of parameters.
81 * Applications send media control requests to routes using the
82 * {@link MediaRouter.RouteInfo#sendControlRequest MediaRouter.RouteInfo.sendControlRequest}
83 * method and receive results via a callback.
84 * </p><p>
85 * All media control intent actions are associated with the media control intent categories
86 * that support them.  Thus only remote playback routes may perform remote playback actions.
87 * The documentation of each action specifies the category to which the action belongs,
88 * the parameters it requires, and the results it returns.
89 * </p>
90 *
91 * <h3>Live audio and live video routes</h3>
92 * <p>
93 * {@link #CATEGORY_LIVE_AUDIO Live audio} and {@link #CATEGORY_LIVE_VIDEO live video}
94 * routes present media using standard system interfaces such as audio streams,
95 * {@link android.app.Presentation presentations} or display mirroring.  These routes are
96 * the easiest to use because applications simply render content locally on the device
97 * and the system streams it to the route destination automatically.
98 * </p><p>
99 * In most cases, applications can stream content to live audio and live video routes in
100 * the same way they would play the content locally without any modification.  However,
101 * applications may also be able to take advantage of more sophisticated features such
102 * as second-screen presentation APIs that are particular to these routes.
103 * </p>
104 *
105 * <h3>Remote playback routes</h3>
106 * <p>
107 * Remote playback routes present media remotely by playing content from a Uri.
108 * These routes destinations take responsibility for fetching and rendering content
109 * on their own.  Applications do not render the content themselves; instead, applications
110 * send control requests to initiate playback, pause, resume, or manipulate queues of
111 * media items and receive status updates when the state of each item changes.
112 * This allows applications to queue several items to play one after another and
113 * provide feedback to the user as playback progresses.
114 * </p>
115 *
116 * <h4>Actions</h4>
117 * <p>
118 * The following actions are defined:
119 * </p><ul>
120 * <li>{@link #ACTION_PLAY Play}: Starts playing or enqueues content specified by a given Uri
121 * and returns a new media item id to describe the request.  Implicitly creates a new
122 * queue of media items if none was specified.
123 * <li>{@link #ACTION_CANCEL Cancel}: Cancels playback of a media item and removes it
124 * from the queue of items to be played.
125 * <li>{@link #ACTION_SEEK Seek}: Sets the content playback position of a media item.
126 * <li>{@link #ACTION_GET_STATUS Get status}: Gets the status of a media item including
127 * the item's current playback position and progress.
128 * <li>{@link #ACTION_PAUSE_QUEUE Pause queue}: Pauses a queue of media items.
129 * <li>{@link #ACTION_RESUME_QUEUE Resume queue}: Resumes a queue of media items.
130 * <li>{@link #ACTION_CLEAR_QUEUE Clear queue}: Cancels and removes all items from a
131 * media queue.
132 * </ul>
133 *
134 * <h4>Media items</h4>
135 * <p>
136 * Each successful {@link #ACTION_PLAY play action} returns a unique media item id that
137 * an application can use to monitor and control playback.  The media item id may be passed
138 * to other actions such as {@link #ACTION_CANCEL cancel}, {@link #ACTION_SEEK seek}
139 * or {@link #ACTION_GET_STATUS get status}.  It will also appear as a parameter in
140 * status update broadcasts to identify the associated playback request.
141 * </p>
142 *
143 * <h4>Queues</h4>
144 * <p>
145 * Each successful {@link #ACTION_PLAY play action} has the effect of adding a new media
146 * item to a queue of media items to be played.  Queues are created implicitly as part
147 * of issuing playback requests and are identified by unique queue ids.
148 * </p><p>
149 * There is at most one valid queue in existence at any given time for a given route.
150 * If an application sends a request that has the effect of creating a new queue then
151 * the previously valid queue is cleared and all of its items are canceled before the
152 * new queue is created.  In this way, one application can determine when another
153 * application has taken control of a route because its own items will all be canceled
154 * as soon as the other application begins playing something else.
155 * </p><p>
156 * Queues are intended to hold a small number of items to help media routes optimize
157 * the playback experience.  As each item in the queue completes playback, the next item
158 * in the queue should begin playing immediately without delay.
159 * </p><p>
160 * It is usually sufficient for an application to enqueue no more than a few items at a time
161 * to ensure continuous playback.  Typically the application will start by enqueuing two
162 * media items at once: one item to play now and one item to play next.  When the first
163 * item finishes, the second item will begin playing immediately.  The application will
164 * receive one status update broadcast indicating that the first item finished playing
165 * and another status update broadcast indicating that the second item has started playing.
166 * Upon receipt of such broadcasts, the application may choose to enqueue another media
167 * item to play once the second one finishes.
168 * </p><p>
169 * Media route providers are required to support queues of at least 3 items.
170 * </p>
171 */
172public final class MediaControlIntent {
173    /**
174     * Media control category: Live audio.
175     * <p>
176     * A route that supports live audio routing will allow the media audio stream
177     * to be sent to supported destinations.  This can include internal speakers or
178     * audio jacks on the device itself, A2DP devices, and more.
179     * </p><p>
180     * When a live audio route is selected, audio routing is transparent to the application.
181     * All audio played on the media stream will be routed to the selected destination.
182     * </p>
183     */
184    public static final String CATEGORY_LIVE_AUDIO = "android.media.intent.category.LIVE_AUDIO";
185
186    /**
187     * Media control category: Live video.
188     * <p>
189     * A route that supports live video routing will allow a mirrored version
190     * of the device's primary display or a customized
191     * {@link android.app.Presentation Presentation} to be sent to supported
192     * destinations.
193     * </p><p>
194     * When a live video route is selected, audio and video routing is transparent
195     * to the application.  By default, audio and video is routed to the selected
196     * destination.  For certain live video routes, the application may also use a
197     * {@link android.app.Presentation Presentation} to replace the mirrored view
198     * on the external display with different content.
199     * </p>
200     *
201     * @see MediaRouter.RouteInfo#getPresentationDisplay()
202     * @see android.app.Presentation
203     */
204    public static final String CATEGORY_LIVE_VIDEO = "android.media.intent.category.LIVE_VIDEO";
205
206    /**
207     * Media control category: Remote playback.
208     * <p>
209     * A route that supports remote playback routing will allow an application to send
210     * requests to play content remotely to supported destinations.
211     * </p><p>
212     * Remote playback routes destinations operate independently of the local device.
213     * When a remote playback route is selected, the application can control the content
214     * playing on the destination by sending media control actions to the route.
215     * The application may also receive status updates from the route regarding
216     * remote playback.
217     * </p>
218     *
219     * @see MediaRouter.RouteInfo#sendControlRequest
220     */
221    public static final String CATEGORY_REMOTE_PLAYBACK =
222            "android.media.intent.category.REMOTE_PLAYBACK";
223
224    /**
225     * Media control action: Play media item.
226     * <p>
227     * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback}
228     * media control.
229     * </p><p>
230     * This action causes a remote playback route to start playing content with
231     * the {@link Uri} specified in the {@link Intent}'s {@link Intent#getData() data uri}.
232     * The action returns a media item id which can be used to control playback
233     * using other remote playback actions.
234     * </p><p>
235     * Once initiated, playback of the specified content will be queued and managed
236     * independently by the destination.  The application will receive status updates
237     * as the content is played.
238     * </p><p>
239     * If the data uri specifies an HTTP or HTTPS scheme, then the destination is
240     * responsible for following HTTP redirects to a reasonable depth of at least 3
241     * levels as might typically be handled by a web browser.  If an HTTP error
242     * occurs, then the destination should send a {@link MediaItemStatus status update}
243     * back to the client indicating the {@link MediaItemStatus#PLAYBACK_STATE_ERROR error}
244     * {@link MediaItemStatus#getPlaybackState() playback state}
245     * and include the {@link MediaItemStatus#EXTRA_HTTP_STATUS_CODE HTTP status code}
246     * and {@link MediaItemStatus#EXTRA_HTTP_RESPONSE_HEADERS response headers}.
247     * </p>
248     *
249     * <h3>Queuing</h3>
250     * <p>
251     * This request has the effect of implicitly creating a media queue whenever the
252     * application does not specify the {@link #EXTRA_QUEUE_ID} parameter.  Because there
253     * can only be one valid queue at a time, creating a new queue has the side-effect
254     * of invalidating any existing queues and canceling all of their items before
255     * enqueuing the new playback request media item onto the newly created queue.
256     * </p><p>
257     * If the application specifies an invalid queue id, then the request has no effect
258     * and an error is returned.  The application may then ask that a new queue be
259     * created (and the current one invalidated) by issuing a new playback request without
260     * a queue id parameter.  However, it should only do this at the user's request
261     * (say, by the user explicitly clicking a play button) since another application may
262     * be trying to take control of the route.
263     * </p><p>
264     * For more information on queuing, please refer to the class documentation.
265     * </p>
266     *
267     * <h3>Request parameters</h3>
268     * <ul>
269     * <li>{@link #EXTRA_QUEUE_ID} <i>(optional)</i>: specifies the queue id of the queue
270     * to which the new playback request should be appended.  If omitted, a new queue
271     * is created.
272     * <li>{@link #EXTRA_ITEM_CONTENT_POSITION} <i>(optional)</i>: specifies the initial
273     * content playback position as a long integer number of milliseconds from
274     * the beginning of the content.
275     * <li>{@link #EXTRA_ITEM_METADATA} <i>(optional)</i>: specifies metadata associated
276     * with the content such as the title of a song.
277     * <li>{@link #EXTRA_ITEM_HTTP_HEADERS} <i>(optional)</i>: specifies HTTP headers to
278     * supply to the server when fetching the content.
279     * <li>{@link #EXTRA_ITEM_STATUS_UPDATE_RECEIVER} <i>(optional)</i>: specifies a
280     * {@link PendingIntent} for a broadcast receiver that will receive status updates
281     * about the media item.
282     * </ul>
283     *
284     * <h3>Result data</h3>
285     * <ul>
286     * <li>{@link #EXTRA_QUEUE_ID} <i>(required)</i>: specifies the queue id of the queue
287     * to which the new media item was appended.  This will be a new queue in
288     * the case where no queue id was supplied as a parameter.
289     * <li>{@link #EXTRA_ITEM_ID} <i>(required)</i>: specifies an opaque string identifier
290     * to use to refer to the media item in subsequent requests such as {@link #ACTION_CANCEL}.
291     * <li>{@link #EXTRA_ITEM_STATUS} <i>(required)</i>: specifies the initial status of
292     * the item that has been enqueued.
293     * </ul>
294     *
295     * <h3>Status updates</h3>
296     * <p>
297     * If the client supplies a {@link #EXTRA_ITEM_STATUS_UPDATE_RECEIVER status update receiver}
298     * then the media route provider is responsible for sending status updates to the receiver
299     * when significant media item state changes occur such as when playback starts or
300     * stops.  The receiver will not be invoked for content playback position changes.
301     * The application may retrieve the current playback position when necessary
302     * using the {@link #ACTION_GET_STATUS} request.
303     * </p><p>
304     * Refer to {@link MediaItemStatus} for details.
305     * </p>
306     *
307     * <h3>Example</h3>
308     * <pre>
309     * MediaRouter mediaRouter = MediaRouter.getInstance(context);
310     * MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute();
311     * Intent intent = new Intent(MediaControlIntent.ACTION_PLAY);
312     * intent.addCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK);
313     * intent.setDataAndType("http://example.com/videos/movie.mp4", "video/mp4");
314     * if (route.supportsControlRequest(intent)) {
315     *     MediaRouter.ControlRequestCallback callback = new MediaRouter.ControlRequestCallback() {
316     *         public void onResult(Bundle data) {
317     *             // The request succeeded.
318     *             // Playback may be controlled using the returned queue and item id.
319     *             String queueId = data.getString(MediaControlIntent.EXTRA_QUEUE_ID);
320     *             String itemId = data.getString(MediaControlIntent.EXTRA_ITEM_ID);
321     *             MediaItemStatus status = MediaItemStatus.fromBundle(data.getBundle(
322     *                     MediaControlIntent.EXTRA_ITEM_STATUS));
323     *             // ...
324     *         }
325     *
326     *         public void onError(String message, Bundle data) {
327     *             // An error occurred!
328     *         }
329     *     };
330     *     route.sendControlRequest(intent, callback);
331     * }</pre>
332     *
333     * @see MediaRouter.RouteInfo#sendControlRequest
334     * @see #CATEGORY_REMOTE_PLAYBACK
335     * @see #ACTION_CANCEL
336     * @see #ACTION_SEEK
337     * @see #ACTION_GET_STATUS
338     */
339    public static final String ACTION_PLAY = "android.media.intent.action.PLAY";
340
341    /**
342     * Media control action: Cancel media item playback.
343     * <p>
344     * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback}
345     * media control.
346     * </p><p>
347     * This action causes a remote playback route to cancel playback of the
348     * specified media item and remove it from the queue.
349     * </p><p>
350     * This action has no effect if the media item's status is
351     * {@link MediaItemStatus#PLAYBACK_STATE_CANCELED} or
352     * {@link MediaItemStatus#PLAYBACK_STATE_ERROR}.
353     * Otherwise the media item's status is set to
354     * {@link MediaItemStatus#PLAYBACK_STATE_CANCELED}, playback of this media item is
355     * stopped if it had been playing and the item is removed from the queue (skipped).
356     * </p><p>
357     * A status update is sent to the status update receiver indicating the new status
358     * of the item.
359     * </p>
360     *
361     * <h3>Request parameters</h3>
362     * <ul>
363     * <li>{@link #EXTRA_QUEUE_ID} <i>(required)</i>: specifies the queue id of the queue
364     * to which the media item belongs.
365     * <li>{@link #EXTRA_ITEM_ID} (required): specifies the media item id of media item
366     * to cancel.
367     * </ul>
368     *
369     * <h3>Result data</h3>
370     * <ul>
371     * <li>{@link #EXTRA_ITEM_STATUS} <i>(required)</i>: specifies the new status of the item.
372     * </ul>
373     *
374     * @see MediaRouter.RouteInfo#sendControlRequest
375     * @see #CATEGORY_REMOTE_PLAYBACK
376     */
377    public static final String ACTION_CANCEL = "android.media.intent.action.CANCEL";
378
379    /**
380     * Media control action: Seek media item to a new playback position.
381     * <p>
382     * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback}
383     * media control.
384     * </p><p>
385     * This action causes a remote playback route to modify the current playback
386     * position of the specified media item.
387     * </p><p>
388     * This action only affects the playback position of the media item; not its playback state.
389     * If the item is paused, then seeking sets the position but the item remains paused.
390     * Likewise if the item is playing, then seeking will cause playback to jump to the
391     * new position and continue playing from that point.  If the item has not yet started
392     * playing, then the new playback position is be remembered and used as the item's
393     * initial content position when playback eventually begins.
394     * </p>
395     *
396     * <h3>Request parameters</h3>
397     * <ul>
398     * <li>{@link #EXTRA_QUEUE_ID} <i>(required)</i>: specifies the queue id of the queue
399     * to which the media item belongs.
400     * <li>{@link #EXTRA_ITEM_ID} <i>(required)</i>: specifies the media item id of
401     * the media item to seek.
402     * <li>{@link #EXTRA_ITEM_CONTENT_POSITION} <i>(required)</i>: specifies the new
403     * content position for playback as a long integer number of milliseconds from
404     * the beginning of the content.
405     * </ul>
406     *
407     * <h3>Result data</h3>
408     * <ul>
409     * <li>{@link #EXTRA_ITEM_STATUS} <i>(required)</i>: specifies the new status of the item.
410     * </ul>
411     *
412     * @see MediaRouter.RouteInfo#sendControlRequest
413     * @see #CATEGORY_REMOTE_PLAYBACK
414     */
415    public static final String ACTION_SEEK = "android.media.intent.action.SEEK";
416
417    /**
418     * Media control action: Get media item playback status and progress information.
419     * <p>
420     * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback}
421     * media control.
422     * </p><p>
423     * This action asks a remote playback route to provide updated playback status and progress
424     * information about the specified media item.
425     * </p>
426     *
427     * <h3>Request parameters</h3>
428     * <ul>
429     * <li>{@link #EXTRA_QUEUE_ID} <i>(required)</i>: specifies the queue id of the queue
430     * to which the media item belongs.
431     * <li>{@link #EXTRA_ITEM_ID} <i>(required)</i>: specifies the media item id of
432     * the media item to query.
433     * </ul>
434     *
435     * <h3>Result data</h3>
436     * <ul>
437     * <li>{@link #EXTRA_ITEM_STATUS} <i>(required)</i>: specifies the current status of the item.
438     * </ul>
439     *
440     * @see MediaRouter.RouteInfo#sendControlRequest
441     * @see #CATEGORY_REMOTE_PLAYBACK
442     * @see #EXTRA_ITEM_STATUS_UPDATE_RECEIVER
443     */
444    public static final String ACTION_GET_STATUS = "android.media.intent.action.GET_STATUS";
445
446    /**
447     * Media control action: Pause media queue playback.
448     * <p>
449     * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback}
450     * media control.
451     * </p><p>
452     * This action causes playback on the specified media queue to be paused.
453     * </p>
454     *
455     * <h3>Request parameters</h3>
456     * <ul>
457     * <li>{@link #EXTRA_QUEUE_ID} <i>(required)</i>: specifies the queue id of the queue
458     * to be paused.
459     * </ul>
460     *
461     * <h3>Result data</h3>
462     * <ul>
463     * <li><i>None</i>
464     * </ul>
465     *
466     * @see MediaRouter.RouteInfo#sendControlRequest
467     * @see #CATEGORY_REMOTE_PLAYBACK
468     * @see #ACTION_RESUME_QUEUE
469     */
470    public static final String ACTION_PAUSE_QUEUE = "android.media.intent.action.PAUSE_QUEUE";
471
472    /**
473     * Media control action: Resume media queue playback (unpause).
474     * <p>
475     * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback}
476     * media control.
477     * </p><p>
478     * This action causes playback on the specified media queue to be resumed.
479     * Reverses the effects of {@link #ACTION_PAUSE_QUEUE}.
480     * </p>
481     *
482     * <h3>Request parameters</h3>
483     * <ul>
484     * <li>{@link #EXTRA_QUEUE_ID} <i>(required)</i>: specifies the queue id of the queue
485     * to be resumed.
486     * </ul>
487     *
488     * <h3>Result data</h3>
489     * <ul>
490     * <li><i>None</i>
491     * </ul>
492     *
493     * @see MediaRouter.RouteInfo#sendControlRequest
494     * @see #CATEGORY_REMOTE_PLAYBACK
495     * @see #ACTION_PAUSE_QUEUE
496     */
497    public static final String ACTION_RESUME_QUEUE = "android.media.intent.action.RESUME_QUEUE";
498
499    /**
500     * Media control action: Clear media queue.
501     * <p>
502     * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback}
503     * media control.
504     * </p><p>
505     * This action causes all media items in the specified media queue to be canceled
506     * and removed.  The queue is left in an empty state.
507     * </p>
508     *
509     * <h3>Request parameters</h3>
510     * <ul>
511     * <li>{@link #EXTRA_QUEUE_ID} <i>(required)</i>: specifies the queue id of the queue
512     * to be cleared.
513     * </ul>
514     *
515     * <h3>Result data</h3>
516     * <ul>
517     * <li><i>None</i>
518     * </ul>
519     *
520     * @see MediaRouter.RouteInfo#sendControlRequest
521     * @see #CATEGORY_REMOTE_PLAYBACK
522     */
523    public static final String ACTION_CLEAR_QUEUE = "android.media.intent.action.CLEAR_QUEUE";
524
525    /**
526     * Bundle extra: Media queue id.
527     * <p>
528     * An opaque unique identifier returned as a result from {@link #ACTION_PLAY} that
529     * represents the queue of media items to which an item was appended.  Subsequent
530     * playback requests may specify the same queue id to enqueue addition items onto
531     * the same queue.
532     * </p><p>
533     * Used with various actions to specify the id of the media queue to be controlled.
534     * </p><p>
535     * Included in broadcast intents sent to
536     * {@link #EXTRA_ITEM_STATUS_UPDATE_RECEIVER status update receivers} to identify
537     * the queue to which the item in question belongs.
538     * </p><p>
539     * The value is a unique string value generated by the media route provider
540     * to represent one particular media queue.
541     * </p>
542     *
543     * @see #ACTION_PLAY
544     * @see #ACTION_CANCEL
545     * @see #ACTION_SEEK
546     * @see #ACTION_GET_STATUS
547     * @see #ACTION_PAUSE_QUEUE
548     * @see #ACTION_RESUME_QUEUE
549     * @see #ACTION_CLEAR_QUEUE
550     */
551    public static final String EXTRA_QUEUE_ID =
552            "android.media.intent.extra.QUEUE_ID";
553
554    /**
555     * Bundle extra: Media item id.
556     * <p>
557     * An opaque unique identifier returned as a result from {@link #ACTION_PLAY} that
558     * represents the media item that was created by the playback request.
559     * </p><p>
560     * Used with various actions to specify the id of the media item to be controlled.
561     * </p><p>
562     * Included in broadcast intents sent to
563     * {@link #EXTRA_ITEM_STATUS_UPDATE_RECEIVER status update receivers} to identify
564     * the item in question.
565     * </p><p>
566     * The value is a unique string value generated by the media route provider
567     * to represent one particular media item.
568     * </p>
569     *
570     * @see #ACTION_PLAY
571     * @see #ACTION_CANCEL
572     * @see #ACTION_SEEK
573     * @see #ACTION_GET_STATUS
574     */
575    public static final String EXTRA_ITEM_ID =
576            "android.media.intent.extra.ITEM_ID";
577
578    /**
579     * Bundle extra: Media item status.
580     * <p>
581     * Returned as a result from media item actions such as {@link #ACTION_PLAY},
582     * {@link #ACTION_SEEK}, {@link #ACTION_CANCEL} and {@link #ACTION_GET_STATUS}
583     * to describe the status of the relevant media item.
584     * </p><p>
585     * Included in broadcast intents sent to
586     * {@link #EXTRA_ITEM_STATUS_UPDATE_RECEIVER status update receivers} to provide
587     * updated status information.
588     * </p><p>
589     * The value is a {@link android.os.Bundle} of data that can be converted into
590     * a {@link MediaItemStatus} object using
591     * {@link MediaItemStatus#fromBundle MediaItemStatus.fromBundle}.
592     * </p>
593     *
594     * @see #ACTION_PLAY
595     * @see #ACTION_CANCEL
596     * @see #ACTION_SEEK
597     * @see #ACTION_GET_STATUS
598     */
599    public static final String EXTRA_ITEM_STATUS =
600            "android.media.intent.extra.ITEM_STATUS";
601
602    /**
603     * Long extra: Media item content position.
604     * <p>
605     * Used with {@link #ACTION_PLAY} to specify the starting playback position.
606     * </p><p>
607     * Used with {@link #ACTION_SEEK} to set a new playback position.
608     * </p><p>
609     * The value is a long integer number of milliseconds from the beginning of the content.
610     * <p>
611     *
612     * @see #ACTION_PLAY
613     * @see #ACTION_SEEK
614     */
615    public static final String EXTRA_ITEM_CONTENT_POSITION =
616            "android.media.intent.extra.ITEM_POSITION";
617
618    /**
619     * Bundle extra: Media item metadata.
620     * <p>
621     * Used with {@link #ACTION_PLAY} to specify metadata associated with the content
622     * of a media item.
623     * </p><p>
624     * The value is a {@link android.os.Bundle} of metadata key-value pairs as defined
625     * in {@link MediaItemMetadata}.
626     * </p>
627     *
628     * @see #ACTION_PLAY
629     */
630    public static final String EXTRA_ITEM_METADATA =
631            "android.media.intent.extra.ITEM_METADATA";
632
633    /**
634     * Bundle extra: HTTP request headers.
635     * <p>
636     * Used with {@link #ACTION_PLAY} to specify HTTP request headers to be
637     * included when fetching to the content indicated by the media item's data Uri.
638     * </p><p>
639     * This extra may be used to provide authentication tokens and other
640     * parameters to the server separately from the media item's data Uri.
641     * </p><p>
642     * The value is a {@link android.os.Bundle} of string based key-value pairs
643     * that describe the HTTP request headers.
644     * </p>
645     *
646     * @see #ACTION_PLAY
647     */
648    public static final String EXTRA_ITEM_HTTP_HEADERS =
649            "android.media.intent.extra.HTTP_HEADERS";
650
651    /**
652     * Bundle extra: Media item status update receiver.
653     * <p>
654     * Used with {@link #ACTION_PLAY} to specify a {@link PendingIntent} for a
655     * broadcast receiver that will receive status updates about a particular
656     * media item.
657     * </p><p>
658     * Whenever the status of the media item changes, the media route provider will
659     * send a broadcast to the pending intent with extras that identify the queue
660     * to which the item belongs, the item itself and the item's updated status.
661     * </p><p>
662     * The same pending intent and broadcast receiver may be shared by any number of
663     * media items since the broadcast intent includes the media queue id and media item id.
664     * </p><p>
665     * The value is a {@link PendingIntent}.
666     * </p>
667     *
668     * <h3>Broadcast extras</h3>
669     * <ul>
670     * <li>{@link #EXTRA_QUEUE_ID} <i>(required)</i>: specifies the media queue id of the
671     * queue to which the item in question belongs.
672     * <li>{@link #EXTRA_ITEM_ID} <i>(required)</i>: specifies the media item id of the
673     * media item in question.
674     * <li>{@link #EXTRA_ITEM_STATUS} <i>(required)</i>: specifies the status of the
675     * item as a bundle that can be decoded into a {@link MediaItemStatus} object.
676     * </ul>
677     *
678     * @see #ACTION_PLAY
679     */
680    public static final String EXTRA_ITEM_STATUS_UPDATE_RECEIVER =
681            "android.media.intent.extra.ITEM_STATUS_UPDATE_RECEIVER";
682
683    private MediaControlIntent() {
684    }
685}
686