1c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown/* 2c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * Copyright (C) 2013 The Android Open Source Project 3c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 4c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * Licensed under the Apache License, Version 2.0 (the "License"); 5c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * you may not use this file except in compliance with the License. 6c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * You may obtain a copy of the License at 7c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 8c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * http://www.apache.org/licenses/LICENSE-2.0 9c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 10c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * Unless required by applicable law or agreed to in writing, software 11c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * distributed under the License is distributed on an "AS IS" BASIS, 12c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * See the License for the specific language governing permissions and 14c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * limitations under the License. 15c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown */ 16c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown 17b507e525a61ed761eecfc2eaaf19af7e8db5dca5Jeff Brownpackage android.support.v7.media; 18c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown 1955eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brownimport android.app.PendingIntent; 20c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brownimport android.content.Intent; 21c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brownimport android.net.Uri; 22c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown 23c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown/** 24de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * Constants for media control intents. 25c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <p> 26de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * This class declares a set of standard media control intent categories and actions that 27de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * applications can use to identify the capabilities of media routes and control them. 28de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p> 2943f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * 30de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * <h3>Media control intent categories</h3> 3143f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <p> 32de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * Media control intent categories specify means by which applications can 33de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * send media to the destination of a media route. Categories are sometimes referred 34de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * to as describing "types" or "kinds" of routes. 35de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 36de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * For example, if a route supports the {@link #CATEGORY_REMOTE_PLAYBACK remote playback category}, 373e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * then an application can ask it to play media remotely by sending a 383e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * {@link #ACTION_PLAY play} or {@link #ACTION_ENQUEUE enqueue} intent with the Uri of the 393e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * media content to play. Such a route may then be referred to as 40de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * a "remote playback route" because it supports remote playback requests. It is common 41de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * for a route to support multiple categories of requests at the same time, such as 42de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * live audio and live video. 43de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 44de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * The following standard route categories are defined. 4543f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </p><ul> 4643f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <li>{@link #CATEGORY_LIVE_AUDIO Live audio}: The route supports streaming live audio 4743f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * from the device to the destination. Live audio routes include local speakers 4843f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * and Bluetooth headsets. 4943f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <li>{@link #CATEGORY_LIVE_VIDEO Live video}: The route supports streaming live video 5043f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * from the device to the destination. Live video routes include local displays 5143f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * and wireless displays that support mirroring and 52de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * {@link android.app.Presentation presentations}. Live video routes typically also 53de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * support live audio capabilities. 5443f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <li>{@link #CATEGORY_REMOTE_PLAYBACK Remote playback}: The route supports sending 5543f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * remote playback requests for media content to the destination. The content to be 5643f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * played is identified by a Uri and mime-type. 57de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </ul><p> 58de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * Media route providers may define custom media control intent categories of their own in 59de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * addition to the standard ones. Custom categories can be used to provide a variety 60de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * of features to applications that recognize and know how to use them. For example, 61de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * a media route provider might define a custom category to indicate that its routes 62de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * support a special device-specific control interface in addition to other 63de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * standard features. 64de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 65de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * Applications can determine which categories a route supports by using the 66de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * {@link MediaRouter.RouteInfo#supportsControlCategory MediaRouter.RouteInfo.supportsControlCategory} 67de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * or {@link MediaRouter.RouteInfo#getControlFilters MediaRouter.RouteInfo.getControlFilters} 68de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * methods. Applications can also specify the types of routes that they want to use by 69de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * creating {@link MediaRouteSelector media route selectors} that contain the desired 70de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * categories and are used to filter routes in several parts of the media router API. 71de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p> 7243f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * 73de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * <h3>Media control intent actions</h3> 7443f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <p> 75de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * Media control intent actions specify particular functions that applications 76de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * can ask the destination of a media route to perform. Media route control requests 77de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * take the form of intents in a similar manner to other intents used to start activities 78de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * or send broadcasts. The difference is that media control intents are directed to 79de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * routes rather than activity or broadcast receiver components. 80de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 81eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Each media route control intent specifies an action, a category and some number of parameters 82eff7719415542ba819054863b0995f07742a7a8aJeff Brown * that are supplied as extras. Applications send media control requests to routes using the 83de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * {@link MediaRouter.RouteInfo#sendControlRequest MediaRouter.RouteInfo.sendControlRequest} 84de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * method and receive results via a callback. 8543f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </p><p> 86de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * All media control intent actions are associated with the media control intent categories 87de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * that support them. Thus only remote playback routes may perform remote playback actions. 88de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * The documentation of each action specifies the category to which the action belongs, 89de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * the parameters it requires, and the results it returns. 9043f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </p> 9143f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * 92de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * <h3>Live audio and live video routes</h3> 9343f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <p> 94de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * {@link #CATEGORY_LIVE_AUDIO Live audio} and {@link #CATEGORY_LIVE_VIDEO live video} 95de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * routes present media using standard system interfaces such as audio streams, 96de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * {@link android.app.Presentation presentations} or display mirroring. These routes are 97de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * the easiest to use because applications simply render content locally on the device 98de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * and the system streams it to the route destination automatically. 9943f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </p><p> 100de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * In most cases, applications can stream content to live audio and live video routes in 101de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * the same way they would play the content locally without any modification. However, 102de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * applications may also be able to take advantage of more sophisticated features such 103de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * as second-screen presentation APIs that are particular to these routes. 10443f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </p> 10543f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * 106de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * <h3>Remote playback routes</h3> 10743f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <p> 1083efa63d3b896244713e84acbb5945562dce41d77Jeff Brown * {@link #CATEGORY_REMOTE_PLAYBACK Remote playback} routes present media remotely 1093efa63d3b896244713e84acbb5945562dce41d77Jeff Brown * by playing content from a Uri. 110de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * These routes destinations take responsibility for fetching and rendering content 111de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * on their own. Applications do not render the content themselves; instead, applications 112eff7719415542ba819054863b0995f07742a7a8aJeff Brown * send control requests to initiate play, pause, resume, or stop media items and receive 113eff7719415542ba819054863b0995f07742a7a8aJeff Brown * status updates as they change state. 114de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p> 115de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * 116eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h4>Sessions</h4> 117de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * <p> 118eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Each remote media playback action is conducted within the scope of a session. 119eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Sessions are used to prevent applications from accidentally interfering with one 120eff7719415542ba819054863b0995f07742a7a8aJeff Brown * another because at most one session can be valid at a time. 121eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p><p> 122aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * A session can be created using the {@link #ACTION_START_SESSION start session action} 123aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * and terminated using the {@link #ACTION_END_SESSION end session action} when the 124aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * route provides explicit session management features. 125eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p><p> 126aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Explicit session management was added in a later revision of the protocol so not 127aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * all routes support it. If the route does not support explicit session management 128aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * then implicit session management may still be used. Implicit session management 129aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * relies on the use of the {@link #ACTION_PLAY play} and {@link #ACTION_ENQUEUE enqueue} 130aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * actions which have the side-effect of creating a new session if none is provided 131aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * as argument. 132aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 133aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * When a new session is created, the previous session is invalidated and any ongoing 134aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * media playback is stopped before the requested action is performed. Any attempt 135aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * to use an invalidated session will result in an error. (Protocol implementations 136aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * are encouraged to aggressively discard information associated with invalidated sessions 137aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * since it is no longer of use.) 138aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 139aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Each session is identified by a unique session id that may be used to control 140aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * the session using actions such as pause, resume, stop and end session. 141eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p> 142de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * 143de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * <h4>Media items</h4> 144de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * <p> 1453e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * Each successful {@link #ACTION_PLAY play} or {@link #ACTION_ENQUEUE enqueue} action 1463e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * returns a unique media item id that an application can use to monitor and control 1473e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * playback. The media item id may be passed to other actions such as 1483e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * {@link #ACTION_SEEK seek} or {@link #ACTION_GET_STATUS get status}. It will also appear 1493e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * as a parameter in status update broadcasts to identify the associated playback request. 150eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p><p> 151eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Each media item is scoped to the session in which it was created. Therefore media item 152eff7719415542ba819054863b0995f07742a7a8aJeff Brown * ids are only ever used together with session ids. Media item ids are meaningless 153eff7719415542ba819054863b0995f07742a7a8aJeff Brown * on their own. When the session is invalidated, all of its media items are also 154eff7719415542ba819054863b0995f07742a7a8aJeff Brown * invalidated. 155de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p> 156eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 157eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h4>The playback queue</h4> 158de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * <p> 159eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Each session has its own playback queue that consists of the media items that 160eff7719415542ba819054863b0995f07742a7a8aJeff Brown * are pending, playing, buffering or paused. Items are added to the queue when 161eff7719415542ba819054863b0995f07742a7a8aJeff Brown * a playback request is issued. Items are removed from the queue when they are no 162eff7719415542ba819054863b0995f07742a7a8aJeff Brown * longer eligible for playback (enter terminal states). 163de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 164eff7719415542ba819054863b0995f07742a7a8aJeff Brown * As described in the {@link MediaItemStatus} class, media items initially 165eff7719415542ba819054863b0995f07742a7a8aJeff Brown * start in a pending state, transition to the playing (or buffering or paused) state 166eff7719415542ba819054863b0995f07742a7a8aJeff Brown * during playback, and end in a finished, canceled, invalidated or error state. 167eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Once the current item enters a terminal state, playback proceeds on to the 168eff7719415542ba819054863b0995f07742a7a8aJeff Brown * next item. 16943f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </p><p> 1703e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * The application should determine whether the route supports queuing by checking 1713e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * whether the {@link #ACTION_ENQUEUE} action is declared in the route's control filter 1723e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * using {@link MediaRouter.RouteInfo#supportsControlRequest RouteInfo.supportsControlRequest}. 1733e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * </p><p> 1743e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * If the {@link #ACTION_ENQUEUE} action is supported by the route, then the route promises 1753e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * to allow at least two items (possibly more) to be enqueued at a time. Enqueued items play 1763e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * back to back one after the other as the previous item completes. Ideally there should 1773e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * be no audible pause between items for standard audio content types. 1783e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * </p><p> 1793e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * If the {@link #ACTION_ENQUEUE} action is not supported by the route, then the queue 1803e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * effectively contains at most one item at a time. Each play action has the effect of 1813e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * clearing the queue and resetting its state before the next item is played. 182eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p> 183eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 184eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h4>Impact of pause, resume, stop and play actions on the playback queue</h4> 185eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <p> 186eff7719415542ba819054863b0995f07742a7a8aJeff Brown * The pause, resume and stop actions affect the session's whole queue. Pause causes 187eff7719415542ba819054863b0995f07742a7a8aJeff Brown * the playback queue to be suspended no matter which item is currently playing. 188eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Resume reverses the effects of pause. Stop clears the queue and also resets 189eff7719415542ba819054863b0995f07742a7a8aJeff Brown * the pause flag just like resume. 19043f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </p><p> 191eff7719415542ba819054863b0995f07742a7a8aJeff Brown * As described earlier, the play action has the effect of clearing the queue 192eff7719415542ba819054863b0995f07742a7a8aJeff Brown * and completely resetting its state (like the stop action) then enqueuing a 193eff7719415542ba819054863b0995f07742a7a8aJeff Brown * new media item to be played immediately. Play is therefore equivalent 194eff7719415542ba819054863b0995f07742a7a8aJeff Brown * to stop followed by an action to enqueue an item. 19543f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </p><p> 196eff7719415542ba819054863b0995f07742a7a8aJeff Brown * The play action is also special in that it can be used to create new sessions. 197eff7719415542ba819054863b0995f07742a7a8aJeff Brown * An application with simple needs may find that it only needs to use play 198eff7719415542ba819054863b0995f07742a7a8aJeff Brown * (and occasionally stop) to control playback. 199eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p> 200eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 201eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h4>Resolving conflicts between applications</h4> 202eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <p> 203eff7719415542ba819054863b0995f07742a7a8aJeff Brown * When an application has a valid session, it is essentially in control of remote playback 204eff7719415542ba819054863b0995f07742a7a8aJeff Brown * on the route. No other application can view or modify the remote playback state 205c9a859537b0871f84afeeb706a5b425fe3f2b4ddAurimas Liutikas * of that application's session without knowing its id. 206eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p><p> 207eff7719415542ba819054863b0995f07742a7a8aJeff Brown * However, other applications can perform actions that have the effect of stopping 208eff7719415542ba819054863b0995f07742a7a8aJeff Brown * playback and invalidating the current session. When this occurs, the former application 209eff7719415542ba819054863b0995f07742a7a8aJeff Brown * will be informed that it has lost control by way of individual media item status 210eff7719415542ba819054863b0995f07742a7a8aJeff Brown * update broadcasts that indicate that its queued media items have become 211eff7719415542ba819054863b0995f07742a7a8aJeff Brown * {@link MediaItemStatus#PLAYBACK_STATE_INVALIDATED invalidated}. This broadcast 212eff7719415542ba819054863b0995f07742a7a8aJeff Brown * implies that playback was terminated abnormally by an external cause. 213eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p><p> 214eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Applications should handle conflicts conservatively to allow other applications to 215eff7719415542ba819054863b0995f07742a7a8aJeff Brown * smoothly assume control over the route. When a conflict occurs, the currently playing 216eff7719415542ba819054863b0995f07742a7a8aJeff Brown * application should release its session and allow the new application to use the 217eff7719415542ba819054863b0995f07742a7a8aJeff Brown * route until such time as the user intervenes to take over the route again and begin 218eff7719415542ba819054863b0995f07742a7a8aJeff Brown * a new playback session. 219eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p> 220eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 2213e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * <h4>Basic actions</h4> 222eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <p> 2233e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * The following basic actions must be supported (all or nothing) by all remote 2243e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * playback routes. These actions form the basis of the remote playback protocol 2253e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * and are required in all implementations. 226eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p><ul> 227eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #ACTION_PLAY Play}: Starts playing content specified by a given Uri 228eff7719415542ba819054863b0995f07742a7a8aJeff Brown * and returns a new media item id to describe the request. Implicitly creates a new 229eff7719415542ba819054863b0995f07742a7a8aJeff Brown * session if no session id was specified as a parameter. 230eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #ACTION_SEEK Seek}: Sets the content playback position of a specific media item. 231eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #ACTION_GET_STATUS Get status}: Gets the status of a media item 232eff7719415542ba819054863b0995f07742a7a8aJeff Brown * including the item's current playback position and progress. 233eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #ACTION_PAUSE Pause}: Pauses playback of the queue. 234eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #ACTION_RESUME Resume}: Resumes playback of the queue. 235eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #ACTION_STOP Stop}: Stops playback, clears the queue, and resets the 236eff7719415542ba819054863b0995f07742a7a8aJeff Brown * pause state. 237eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </ul> 238eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 2393e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * <h4>Queue actions</h4> 2403e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * <p> 2413e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * The following queue actions must be supported (all or nothing) by remote 2423e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * playback routes that offer optional queuing capabilities. 2433e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * </p><ul> 2443e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * <li>{@link #ACTION_ENQUEUE Enqueue}: Enqueues content specified by a given Uri 2453e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * and returns a new media item id to describe the request. Implicitly creates a new 2463e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * session if no session id was specified as a parameter. 2473e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * <li>{@link #ACTION_REMOVE Remove}: Removes a specified media item from the queue. 2483e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * </ul> 2493e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * 250aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <h4>Session actions</h4> 251aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <p> 252aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * The following session actions must be supported (all or nothing) by remote 253aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * playback routes that offer optional session management capabilities. 254aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><ul> 255aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #ACTION_START_SESSION Start session}: Starts a new session explicitly. 256aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #ACTION_GET_SESSION_STATUS Get session status}: Gets the status of a session. 257aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #ACTION_END_SESSION End session}: Ends a session explicitly. 258aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </ul> 259aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 260eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h4>Implementation note</h4> 261eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <p> 262eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Implementations of the remote playback protocol must implement <em>all</em> of the 263eff7719415542ba819054863b0995f07742a7a8aJeff Brown * documented actions, parameters and results. Note that the documentation is written from 264eff7719415542ba819054863b0995f07742a7a8aJeff Brown * the perspective of a client of the protocol. In particular, whenever a parameter 265eff7719415542ba819054863b0995f07742a7a8aJeff Brown * is described as being "optional", it is only from the perspective of the client. 266eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Compliant media route provider implementations of this protocol must support all 267eff7719415542ba819054863b0995f07742a7a8aJeff Brown * of the features described herein. 26843f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </p> 269c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown */ 270c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brownpublic final class MediaControlIntent { 2713efa63d3b896244713e84acbb5945562dce41d77Jeff Brown /* Route categories. */ 2723efa63d3b896244713e84acbb5945562dce41d77Jeff Brown 273c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown /** 274c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * Media control category: Live audio. 275c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <p> 276c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * A route that supports live audio routing will allow the media audio stream 277c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * to be sent to supported destinations. This can include internal speakers or 278c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * audio jacks on the device itself, A2DP devices, and more. 279c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p><p> 280c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * When a live audio route is selected, audio routing is transparent to the application. 281c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * All audio played on the media stream will be routed to the selected destination. 2823efa63d3b896244713e84acbb5945562dce41d77Jeff Brown * </p><p> 2833efa63d3b896244713e84acbb5945562dce41d77Jeff Brown * Refer to the class documentation for details about live audio routes. 284c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p> 285c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown */ 286c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown public static final String CATEGORY_LIVE_AUDIO = "android.media.intent.category.LIVE_AUDIO"; 287c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown 288c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown /** 289c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * Media control category: Live video. 290c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <p> 291c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * A route that supports live video routing will allow a mirrored version 292c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * of the device's primary display or a customized 293c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * {@link android.app.Presentation Presentation} to be sent to supported 294c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * destinations. 295c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p><p> 296c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * When a live video route is selected, audio and video routing is transparent 297c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * to the application. By default, audio and video is routed to the selected 298c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * destination. For certain live video routes, the application may also use a 299c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * {@link android.app.Presentation Presentation} to replace the mirrored view 300c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * on the external display with different content. 3013efa63d3b896244713e84acbb5945562dce41d77Jeff Brown * </p><p> 3023efa63d3b896244713e84acbb5945562dce41d77Jeff Brown * Refer to the class documentation for details about live video routes. 303c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p> 304c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 305c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * @see MediaRouter.RouteInfo#getPresentationDisplay() 306c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * @see android.app.Presentation 307c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown */ 308c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown public static final String CATEGORY_LIVE_VIDEO = "android.media.intent.category.LIVE_VIDEO"; 309c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown 310c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown /** 311c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * Media control category: Remote playback. 312c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <p> 313c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * A route that supports remote playback routing will allow an application to send 314c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * requests to play content remotely to supported destinations. 315c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p><p> 316c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * Remote playback routes destinations operate independently of the local device. 317c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * When a remote playback route is selected, the application can control the content 318c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * playing on the destination by sending media control actions to the route. 319c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * The application may also receive status updates from the route regarding 320c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * remote playback. 3213efa63d3b896244713e84acbb5945562dce41d77Jeff Brown * </p><p> 3223efa63d3b896244713e84acbb5945562dce41d77Jeff Brown * Refer to the class documentation for details about remote playback routes. 323c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p> 324c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 325c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * @see MediaRouter.RouteInfo#sendControlRequest 326c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown */ 327c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown public static final String CATEGORY_REMOTE_PLAYBACK = 328c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown "android.media.intent.category.REMOTE_PLAYBACK"; 329c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown 330eff7719415542ba819054863b0995f07742a7a8aJeff Brown /* Remote playback actions that affect individual items. */ 331eff7719415542ba819054863b0995f07742a7a8aJeff Brown 332c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown /** 333eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Remote playback media control action: Play media item. 334c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <p> 335c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback} 336c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * media control. 337c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p><p> 338c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * This action causes a remote playback route to start playing content with 339c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * the {@link Uri} specified in the {@link Intent}'s {@link Intent#getData() data uri}. 340eff7719415542ba819054863b0995f07742a7a8aJeff Brown * The action returns a media session id and media item id which can be used 341eff7719415542ba819054863b0995f07742a7a8aJeff Brown * to control playback using other remote playback actions. 342c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p><p> 343eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Once initiated, playback of the specified content will be managed independently 344eff7719415542ba819054863b0995f07742a7a8aJeff Brown * by the destination. The application will receive status updates as the state 345eff7719415542ba819054863b0995f07742a7a8aJeff Brown * of the media item changes. 34655eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * </p><p> 34755eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * If the data uri specifies an HTTP or HTTPS scheme, then the destination is 34855eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * responsible for following HTTP redirects to a reasonable depth of at least 3 34955eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * levels as might typically be handled by a web browser. If an HTTP error 3503d4c9459ed77f732dd3ba602713af6ebf9280c8cJeff Brown * occurs, then the destination should send a {@link MediaItemStatus status update} 3513d4c9459ed77f732dd3ba602713af6ebf9280c8cJeff Brown * back to the client indicating the {@link MediaItemStatus#PLAYBACK_STATE_ERROR error} 352eff7719415542ba819054863b0995f07742a7a8aJeff Brown * {@link MediaItemStatus#getPlaybackState() playback state}. 353c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p> 354c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 355eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h3>One item at a time</h3> 356de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * <p> 357eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Each successful play action <em>replaces</em> the previous play action. 358eff7719415542ba819054863b0995f07742a7a8aJeff Brown * If an item is already playing, then it is canceled, the session's playback queue 359eff7719415542ba819054863b0995f07742a7a8aJeff Brown * is cleared and the new item begins playing immediately (regardless of 360eff7719415542ba819054863b0995f07742a7a8aJeff Brown * whether the previously playing item had been paused). 361eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p><p> 362eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Play is therefore equivalent to {@link #ACTION_STOP stop} followed by an action 363eff7719415542ba819054863b0995f07742a7a8aJeff Brown * to enqueue a new media item to be played immediately. 364eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p> 365eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 366eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h3>Sessions</h3> 367eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <p> 368eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This request has the effect of implicitly creating a media session whenever the 369eff7719415542ba819054863b0995f07742a7a8aJeff Brown * application does not specify the {@link #EXTRA_SESSION_ID session id} parameter. 370eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Because there can only be at most one valid session at a time, creating a new session 371eff7719415542ba819054863b0995f07742a7a8aJeff Brown * has the side-effect of invalidating any existing sessions and their media items, 372eff7719415542ba819054863b0995f07742a7a8aJeff Brown * then handling the playback request with a new session. 373eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p><p> 374eff7719415542ba819054863b0995f07742a7a8aJeff Brown * If the application specifies an invalid session id, then an error is returned. 375eff7719415542ba819054863b0995f07742a7a8aJeff Brown * When this happens, the application should assume that its session 376eff7719415542ba819054863b0995f07742a7a8aJeff Brown * is no longer valid. To obtain a new session, the application may try again 377eff7719415542ba819054863b0995f07742a7a8aJeff Brown * and omit the session id parameter. However, the application should 378eff7719415542ba819054863b0995f07742a7a8aJeff Brown * only retry requests due to an explicit action performed by the user, 379eff7719415542ba819054863b0995f07742a7a8aJeff Brown * such as the user clicking on a "play" button in the UI, since another 380eff7719415542ba819054863b0995f07742a7a8aJeff Brown * application may be trying to take control of the route and the former 381eff7719415542ba819054863b0995f07742a7a8aJeff Brown * application should try to stay out of its way. 382eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p><p> 383eff7719415542ba819054863b0995f07742a7a8aJeff Brown * For more information on sessions, queues and media items, please refer to the 384eff7719415542ba819054863b0995f07742a7a8aJeff Brown * class documentation. 385de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p> 386de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * 387c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <h3>Request parameters</h3> 388c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <ul> 389eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_SESSION_ID} <em>(optional)</em>: Specifies the session id of the 390eff7719415542ba819054863b0995f07742a7a8aJeff Brown * session to which the playback request belongs. If omitted, a new session 391eff7719415542ba819054863b0995f07742a7a8aJeff Brown * is created implicitly. 392eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_CONTENT_POSITION} <em>(optional)</em>: Specifies the initial 393ba811896e3057cb48ad0f017efe1bf0c262430ecJeff Brown * content playback position as a long integer number of milliseconds from 394ba811896e3057cb48ad0f017efe1bf0c262430ecJeff Brown * the beginning of the content. 395eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_METADATA} <em>(optional)</em>: Specifies metadata associated 396de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * with the content such as the title of a song. 397eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_STATUS_UPDATE_RECEIVER} <em>(optional)</em>: Specifies a 398de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * {@link PendingIntent} for a broadcast receiver that will receive status updates 399de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * about the media item. 400c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </ul> 401c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 402c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <h3>Result data</h3> 403c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <ul> 404eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_SESSION_ID} <em>(always returned)</em>: Specifies the session id of the 405eff7719415542ba819054863b0995f07742a7a8aJeff Brown * session that was affected by the request. This will be a new session in 406eff7719415542ba819054863b0995f07742a7a8aJeff Brown * the case where no session id was supplied as a parameter. 407aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_STATUS} <em>(optional, old implementations may 408aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * omit this key)</em>: Specifies the status of the media session. 409eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_ID} <em>(always returned)</em>: Specifies an opaque string identifier 410eff7719415542ba819054863b0995f07742a7a8aJeff Brown * to use to refer to the media item in subsequent requests such as 411eff7719415542ba819054863b0995f07742a7a8aJeff Brown * {@link #ACTION_GET_STATUS}. 412eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_STATUS} <em>(always returned)</em>: Specifies the initial status of 413eff7719415542ba819054863b0995f07742a7a8aJeff Brown * the new media item. 414c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </ul> 415c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 41655eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * <h3>Status updates</h3> 41755eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * <p> 4183e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * If the client supplies an 4193e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * {@link #EXTRA_ITEM_STATUS_UPDATE_RECEIVER item status update receiver} 42055eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * then the media route provider is responsible for sending status updates to the receiver 4213d4c9459ed77f732dd3ba602713af6ebf9280c8cJeff Brown * when significant media item state changes occur such as when playback starts or 4223d4c9459ed77f732dd3ba602713af6ebf9280c8cJeff Brown * stops. The receiver will not be invoked for content playback position changes. 4233d4c9459ed77f732dd3ba602713af6ebf9280c8cJeff Brown * The application may retrieve the current playback position when necessary 4243d4c9459ed77f732dd3ba602713af6ebf9280c8cJeff Brown * using the {@link #ACTION_GET_STATUS} request. 4253d4c9459ed77f732dd3ba602713af6ebf9280c8cJeff Brown * </p><p> 4263d4c9459ed77f732dd3ba602713af6ebf9280c8cJeff Brown * Refer to {@link MediaItemStatus} for details. 42755eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * </p> 42855eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * 429eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h3>Errors</h3> 430eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <p> 431eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action returns an error if a session id was provided but is unknown or 432eff7719415542ba819054863b0995f07742a7a8aJeff Brown * no longer valid, if the item Uri or content type is not supported, or if 433eff7719415542ba819054863b0995f07742a7a8aJeff Brown * any other arguments are invalid. 434b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </p><ul> 435b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * <li>{@link #EXTRA_ERROR_CODE} <em>(optional)</em>: Specifies the cause of the error. 436b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </ul> 437eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 438c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <h3>Example</h3> 439c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <pre> 440c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * MediaRouter mediaRouter = MediaRouter.getInstance(context); 441c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute(); 442c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * Intent intent = new Intent(MediaControlIntent.ACTION_PLAY); 443c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * intent.addCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK); 444c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * intent.setDataAndType("http://example.com/videos/movie.mp4", "video/mp4"); 445fa326a4649d9d0e8113e315f6c8251fe686abce4Jeff Brown * if (route.supportsControlRequest(intent)) { 446fa326a4649d9d0e8113e315f6c8251fe686abce4Jeff Brown * MediaRouter.ControlRequestCallback callback = new MediaRouter.ControlRequestCallback() { 447de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * public void onResult(Bundle data) { 448de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * // The request succeeded. 449eff7719415542ba819054863b0995f07742a7a8aJeff Brown * // Playback may be controlled using the returned session and item id. 450eff7719415542ba819054863b0995f07742a7a8aJeff Brown * String sessionId = data.getString(MediaControlIntent.EXTRA_SESSION_ID); 451de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * String itemId = data.getString(MediaControlIntent.EXTRA_ITEM_ID); 452de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * MediaItemStatus status = MediaItemStatus.fromBundle(data.getBundle( 453de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * MediaControlIntent.EXTRA_ITEM_STATUS)); 454de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * // ... 455de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * } 456de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * 457de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * public void onError(String message, Bundle data) { 458de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * // An error occurred! 459c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * } 460fa326a4649d9d0e8113e315f6c8251fe686abce4Jeff Brown * }; 461fa326a4649d9d0e8113e315f6c8251fe686abce4Jeff Brown * route.sendControlRequest(intent, callback); 462c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * }</pre> 463c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 464c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * @see MediaRouter.RouteInfo#sendControlRequest 465c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * @see #CATEGORY_REMOTE_PLAYBACK 46643f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * @see #ACTION_SEEK 46743f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * @see #ACTION_GET_STATUS 468eff7719415542ba819054863b0995f07742a7a8aJeff Brown * @see #ACTION_PAUSE 469eff7719415542ba819054863b0995f07742a7a8aJeff Brown * @see #ACTION_RESUME 470eff7719415542ba819054863b0995f07742a7a8aJeff Brown * @see #ACTION_STOP 471c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown */ 472c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown public static final String ACTION_PLAY = "android.media.intent.action.PLAY"; 473c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown 474c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown /** 475eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Remote playback media control action: Enqueue media item. 476129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <p> 477129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback} 478129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * media control. 479129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p><p> 480eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action works just like {@link #ACTION_PLAY play} except that it does 481eff7719415542ba819054863b0995f07742a7a8aJeff Brown * not clear the queue or reset the pause state when it enqueues the 482eff7719415542ba819054863b0995f07742a7a8aJeff Brown * new media item into the session's playback queue. This action only 483eff7719415542ba819054863b0995f07742a7a8aJeff Brown * enqueues a media item with no other side-effects on the queue. 484129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p><p> 485eff7719415542ba819054863b0995f07742a7a8aJeff Brown * If the queue is currently empty and then the item will play immediately 486eff7719415542ba819054863b0995f07742a7a8aJeff Brown * (assuming the queue is not paused). Otherwise, the item will play 487eff7719415542ba819054863b0995f07742a7a8aJeff Brown * after all earlier items in the queue have finished or been removed. 488de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 489eff7719415542ba819054863b0995f07742a7a8aJeff Brown * The enqueue action can be used to create new sessions just like play. 490eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Its parameters and results are also the same. Only the queuing behavior 491eff7719415542ba819054863b0995f07742a7a8aJeff Brown * is different. 492129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p> 493129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * 494eff7719415542ba819054863b0995f07742a7a8aJeff Brown * @see #ACTION_PLAY 495129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown */ 496eff7719415542ba819054863b0995f07742a7a8aJeff Brown public static final String ACTION_ENQUEUE = "android.media.intent.action.ENQUEUE"; 497129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown 498129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown /** 499eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Remote playback media control action: Seek media item to a new playback position. 50043f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <p> 50143f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback} 50243f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * media control. 50343f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </p><p> 504eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action causes a remote playback route to modify the current playback position 505eff7719415542ba819054863b0995f07742a7a8aJeff Brown * of the specified media item. 50643f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </p><p> 507de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * This action only affects the playback position of the media item; not its playback state. 508eff7719415542ba819054863b0995f07742a7a8aJeff Brown * If the playback queue is paused, then seeking sets the position but the item 509eff7719415542ba819054863b0995f07742a7a8aJeff Brown * remains paused. Likewise if the item is playing, then seeking will cause playback 510eff7719415542ba819054863b0995f07742a7a8aJeff Brown * to jump to the new position and continue playing from that point. If the item has 511eff7719415542ba819054863b0995f07742a7a8aJeff Brown * not yet started playing, then the new playback position is remembered by the 512eff7719415542ba819054863b0995f07742a7a8aJeff Brown * queue and used as the item's initial content position when playback eventually begins. 513eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p><p> 514eff7719415542ba819054863b0995f07742a7a8aJeff Brown * If successful, the media item's playback position is changed. 51543f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </p> 51643f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * 51743f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <h3>Request parameters</h3> 51843f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <ul> 519eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_SESSION_ID} <em>(required)</em>: Specifies the session id of the session 520de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * to which the media item belongs. 521eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_ID} <em>(required)</em>: Specifies the media item id of 522de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * the media item to seek. 523eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_CONTENT_POSITION} <em>(required)</em>: Specifies the new 524ba811896e3057cb48ad0f017efe1bf0c262430ecJeff Brown * content position for playback as a long integer number of milliseconds from 525ba811896e3057cb48ad0f017efe1bf0c262430ecJeff Brown * the beginning of the content. 52643f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </ul> 52743f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * 52843f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <h3>Result data</h3> 52943f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <ul> 530aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_STATUS} <em>(optional, old implementations may 531aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * omit this key)</em>: Specifies the status of the media session. 532eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_STATUS} <em>(always returned)</em>: Specifies the new status of 533eff7719415542ba819054863b0995f07742a7a8aJeff Brown * the media item. 53443f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </ul> 53543f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * 536eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h3>Errors</h3> 537eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <p> 538eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action returns an error if the session id or media item id are unknown 539eff7719415542ba819054863b0995f07742a7a8aJeff Brown * or no longer valid, if the content position is invalid, or if the media item 540eff7719415542ba819054863b0995f07742a7a8aJeff Brown * is in a terminal state. 541b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </p><ul> 542b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * <li>{@link #EXTRA_ERROR_CODE} <em>(optional)</em>: Specifies the cause of the error. 543b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </ul> 544eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 54543f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * @see MediaRouter.RouteInfo#sendControlRequest 54643f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * @see #CATEGORY_REMOTE_PLAYBACK 54743f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown */ 548de3d4d3c033fc939af83775a443b295a4034444cJeff Brown public static final String ACTION_SEEK = "android.media.intent.action.SEEK"; 54943f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown 55043f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown /** 551eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Remote playback media control action: Get media item playback status 552eff7719415542ba819054863b0995f07742a7a8aJeff Brown * and progress information. 553129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <p> 554129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback} 555129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * media control. 556129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p><p> 557de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * This action asks a remote playback route to provide updated playback status and progress 558de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * information about the specified media item. 559129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p> 560129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * 561129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <h3>Request parameters</h3> 562129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <ul> 563eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_SESSION_ID} <em>(required)</em>: Specifies the session id of the session 564de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * to which the media item belongs. 565eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_ID} <em>(required)</em>: Specifies the media item id of 566de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * the media item to query. 567129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </ul> 568129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * 569129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <h3>Result data</h3> 570129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <ul> 571aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_STATUS} <em>(optional, old implementations may 572aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * omit this key)</em>: Specifies the status of the media session. 573eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_STATUS} <em>(always returned)</em>: Specifies the current status of 574eff7719415542ba819054863b0995f07742a7a8aJeff Brown * the media item. 575129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </ul> 576129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * 577eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h3>Errors</h3> 578eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <p> 579eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action returns an error if the session id or media item id are unknown 580eff7719415542ba819054863b0995f07742a7a8aJeff Brown * or no longer valid. 581b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </p><ul> 582b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * <li>{@link #EXTRA_ERROR_CODE} <em>(optional)</em>: Specifies the cause of the error. 583b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </ul> 584eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 585129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * @see MediaRouter.RouteInfo#sendControlRequest 586129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * @see #CATEGORY_REMOTE_PLAYBACK 587de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * @see #EXTRA_ITEM_STATUS_UPDATE_RECEIVER 588129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown */ 589de3d4d3c033fc939af83775a443b295a4034444cJeff Brown public static final String ACTION_GET_STATUS = "android.media.intent.action.GET_STATUS"; 590129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown 591129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown /** 592eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Remote playback media control action: Remove media item from session's queue. 593129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <p> 594129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback} 595129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * media control. 596129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p><p> 597eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action asks a remote playback route to remove the specified media item 598eff7719415542ba819054863b0995f07742a7a8aJeff Brown * from the session's playback queue. If the current item is removed, then 599eff7719415542ba819054863b0995f07742a7a8aJeff Brown * playback will proceed to the next media item (assuming the queue has not been 600eff7719415542ba819054863b0995f07742a7a8aJeff Brown * paused). 601eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p><p> 602eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action does not affect the pause state of the queue. If the queue was paused 603eff7719415542ba819054863b0995f07742a7a8aJeff Brown * then it remains paused (even if it is now empty) until a resume, stop or play 604eff7719415542ba819054863b0995f07742a7a8aJeff Brown * action is issued that causes the pause state to be cleared. 605129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p> 606129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * 607129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <h3>Request parameters</h3> 608129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <ul> 609eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_SESSION_ID} <em>(required)</em>: Specifies the session id of the session 610eff7719415542ba819054863b0995f07742a7a8aJeff Brown * to which the media item belongs. 611eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_ID} <em>(required)</em>: Specifies the media item id of 612eff7719415542ba819054863b0995f07742a7a8aJeff Brown * the media item to remove. 613129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </ul> 614129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * 615129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <h3>Result data</h3> 616129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <ul> 617aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_STATUS} <em>(optional, old implementations may 618aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * omit this key)</em>: Specifies the status of the media session. 619eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_STATUS} <em>(always returned)</em>: Specifies the new status of 620eff7719415542ba819054863b0995f07742a7a8aJeff Brown * the media item. 621129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </ul> 622129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * 623eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h3>Errors</h3> 624eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <p> 625eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action returns an error if the session id or media item id are unknown 626eff7719415542ba819054863b0995f07742a7a8aJeff Brown * or no longer valid, or if the media item is in a terminal state (and therefore 627eff7719415542ba819054863b0995f07742a7a8aJeff Brown * no longer in the queue). 628b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </p><ul> 629b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * <li>{@link #EXTRA_ERROR_CODE} <em>(optional)</em>: Specifies the cause of the error. 630b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </ul> 631eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 632129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * @see MediaRouter.RouteInfo#sendControlRequest 633129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * @see #CATEGORY_REMOTE_PLAYBACK 634129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown */ 635eff7719415542ba819054863b0995f07742a7a8aJeff Brown public static final String ACTION_REMOVE = "android.media.intent.action.REMOVE"; 636eff7719415542ba819054863b0995f07742a7a8aJeff Brown 637eff7719415542ba819054863b0995f07742a7a8aJeff Brown /* Remote playback actions that affect the whole playback queue. */ 638129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown 639129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown /** 640eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Remote playback media control action: Pause media playback. 641129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <p> 642129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback} 643129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * media control. 644129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p><p> 645eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action causes the playback queue of the specified session to be paused. 646129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p> 647129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * 648129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <h3>Request parameters</h3> 649129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <ul> 650eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_SESSION_ID} <em>(required)</em>: Specifies the session id of the session 651eff7719415542ba819054863b0995f07742a7a8aJeff Brown * whose playback queue is to be paused. 652129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </ul> 653129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * 654129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <h3>Result data</h3> 655129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <ul> 656aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_STATUS} <em>(optional, old implementations may 657aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * omit this key)</em>: Specifies the status of the media session. 658129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </ul> 659129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * 660eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h3>Errors</h3> 661eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <p> 662eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action returns an error if the session id is unknown or no longer valid. 663b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </p><ul> 664b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * <li>{@link #EXTRA_ERROR_CODE} <em>(optional)</em>: Specifies the cause of the error. 665b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </ul> 666eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 667129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * @see MediaRouter.RouteInfo#sendControlRequest 668129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * @see #CATEGORY_REMOTE_PLAYBACK 669eff7719415542ba819054863b0995f07742a7a8aJeff Brown * @see #ACTION_RESUME 670129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown */ 671eff7719415542ba819054863b0995f07742a7a8aJeff Brown public static final String ACTION_PAUSE = "android.media.intent.action.PAUSE"; 672129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown 673129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown /** 674eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Remote playback media control action: Resume media playback (unpause). 675c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <p> 676de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback} 677de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * media control. 678c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p><p> 679eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action causes the playback queue of the specified session to be resumed. 680eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Reverses the effects of {@link #ACTION_PAUSE}. 681c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p> 682c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 683de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * <h3>Request parameters</h3> 684de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * <ul> 685eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_SESSION_ID} <em>(required)</em>: Specifies the session id of the session 686eff7719415542ba819054863b0995f07742a7a8aJeff Brown * whose playback queue is to be resumed. 687de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </ul> 688de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * 689de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * <h3>Result data</h3> 690de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * <ul> 691aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_STATUS} <em>(optional, old implementations may 692aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * omit this key)</em>: Specifies the status of the media session. 693de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </ul> 694de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * 695eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h3>Errors</h3> 696eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <p> 697eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action returns an error if the session id is unknown or no longer valid. 698b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </p><ul> 699b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * <li>{@link #EXTRA_ERROR_CODE} <em>(optional)</em>: Specifies the cause of the error. 700b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </ul> 701eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 702de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * @see MediaRouter.RouteInfo#sendControlRequest 703de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * @see #CATEGORY_REMOTE_PLAYBACK 704eff7719415542ba819054863b0995f07742a7a8aJeff Brown * @see #ACTION_PAUSE 705c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown */ 706eff7719415542ba819054863b0995f07742a7a8aJeff Brown public static final String ACTION_RESUME = "android.media.intent.action.RESUME"; 707c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown 708c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown /** 709eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Remote playback media control action: Stop media playback (clear queue and unpause). 710c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <p> 711eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback} 712eff7719415542ba819054863b0995f07742a7a8aJeff Brown * media control. 713de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 714eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action causes a remote playback route to stop playback, cancel and remove 715eff7719415542ba819054863b0995f07742a7a8aJeff Brown * all media items from the session's media item queue and, reset the queue's 716eff7719415542ba819054863b0995f07742a7a8aJeff Brown * pause state. 717eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p><p> 718eff7719415542ba819054863b0995f07742a7a8aJeff Brown * If successful, the status of all media items in the queue is set to 719eff7719415542ba819054863b0995f07742a7a8aJeff Brown * {@link MediaItemStatus#PLAYBACK_STATE_CANCELED canceled} and a status update is sent 720eff7719415542ba819054863b0995f07742a7a8aJeff Brown * to the appropriate status update receivers indicating the new status of each item. 721eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p> 722eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 723eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h3>Request parameters</h3> 724eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <ul> 725eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_SESSION_ID} <em>(required)</em>: Specifies the session id of 726eff7719415542ba819054863b0995f07742a7a8aJeff Brown * the session whose playback queue is to be stopped (cleared and unpaused). 727eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </ul> 728eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 729eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h3>Result data</h3> 730eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <ul> 731aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_STATUS} <em>(optional, old implementations may 732aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * omit this key)</em>: Specifies the status of the media session. 733eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </ul> 734eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 735eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <h3>Errors</h3> 736eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <p> 737eff7719415542ba819054863b0995f07742a7a8aJeff Brown * This action returns an error if the session id is unknown or no longer valid. 738b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </p><ul> 739b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * <li>{@link #EXTRA_ERROR_CODE} <em>(optional)</em>: Specifies the cause of the error. 740b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </ul> 741eff7719415542ba819054863b0995f07742a7a8aJeff Brown * 742eff7719415542ba819054863b0995f07742a7a8aJeff Brown * @see MediaRouter.RouteInfo#sendControlRequest 743eff7719415542ba819054863b0995f07742a7a8aJeff Brown * @see #CATEGORY_REMOTE_PLAYBACK 744eff7719415542ba819054863b0995f07742a7a8aJeff Brown */ 745eff7719415542ba819054863b0995f07742a7a8aJeff Brown public static final String ACTION_STOP = "android.media.intent.action.STOP"; 746eff7719415542ba819054863b0995f07742a7a8aJeff Brown 747eff7719415542ba819054863b0995f07742a7a8aJeff Brown /** 748aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Remote playback media control action: Start session. 749aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <p> 750aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback} 751aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * media control. 752aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 753aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * This action causes a remote playback route to invalidate the current session 754aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * and start a new session. The new session initially has an empty queue. 755aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 756aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * If successful, the status of all media items in the previous session's queue is set to 757aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * {@link MediaItemStatus#PLAYBACK_STATE_INVALIDATED invalidated} and a status update 758aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * is sent to the appropriate status update receivers indicating the new status 759aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * of each item. The previous session becomes no longer valid and the new session 760aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * takes control of the route. 761aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p> 762aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 763aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <h3>Request parameters</h3> 764aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <ul> 765aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_STATUS_UPDATE_RECEIVER} <em>(optional)</em>: Specifies a 766aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * {@link PendingIntent} for a broadcast receiver that will receive status updates 767aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * about the media session. 76839c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * <li>{@link #EXTRA_MESSAGE_RECEIVER} <em>(optional)</em>: Specifies a 76939c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * {@link PendingIntent} for a broadcast receiver that will receive messages from 770dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * the media session. 771aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </ul> 772aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 773aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <h3>Result data</h3> 774aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <ul> 775aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_ID} <em>(always returned)</em>: Specifies the session id of the 776aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * session that was started by the request. This will always be a brand new session 777aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * distinct from any other previously created sessions. 778aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_STATUS} <em>(always returned)</em>: Specifies the 779aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * status of the media session. 780aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </ul> 781aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 782aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <h3>Status updates</h3> 783aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <p> 784aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * If the client supplies a 785aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * {@link #EXTRA_SESSION_STATUS_UPDATE_RECEIVER status update receiver} 786aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * then the media route provider is responsible for sending status updates to the receiver 787aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * when significant media session state changes occur such as when the session's 788aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * queue is paused or resumed or when the session is terminated or invalidated. 789aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 790aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Refer to {@link MediaSessionStatus} for details. 791aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p> 792aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 793dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * <h3>Custom messages</h3> 794dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * <p> 79539c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * If the client supplies a {@link #EXTRA_MESSAGE_RECEIVER message receiver} 796dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * then the media route provider is responsible for sending messages to the receiver 797dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * when the session has any messages to send. 798dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * </p><p> 79939c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * Refer to {@link #EXTRA_MESSAGE} for details. 800dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * </p> 801dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * 802aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <h3>Errors</h3> 803aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <p> 804aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * This action returns an error if the session could not be created. 805b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </p><ul> 806b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * <li>{@link #EXTRA_ERROR_CODE} <em>(optional)</em>: Specifies the cause of the error. 807b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </ul> 808aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 809aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see MediaRouter.RouteInfo#sendControlRequest 810aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #CATEGORY_REMOTE_PLAYBACK 811aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown */ 812aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown public static final String ACTION_START_SESSION = "android.media.intent.action.START_SESSION"; 813aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown 814aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown /** 815aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Remote playback media control action: Get media session status information. 816aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <p> 817aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback} 818aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * media control. 819aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 820aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * This action asks a remote playback route to provide updated status information 821aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * about the specified media session. 822aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p> 823aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 824aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <h3>Request parameters</h3> 825aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <ul> 826aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_ID} <em>(required)</em>: Specifies the session id of the 827aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * session whose status is to be retrieved. 828aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </ul> 829aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 830aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <h3>Result data</h3> 831aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <ul> 832aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_STATUS} <em>(always returned)</em>: Specifies the 833aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * current status of the media session. 834aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </ul> 835aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 836aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <h3>Errors</h3> 837aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <p> 838aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * This action returns an error if the session id is unknown or no longer valid. 839b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </p><ul> 840b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * <li>{@link #EXTRA_ERROR_CODE} <em>(optional)</em>: Specifies the cause of the error. 841b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </ul> 842aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 843aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see MediaRouter.RouteInfo#sendControlRequest 844aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #CATEGORY_REMOTE_PLAYBACK 845aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #EXTRA_SESSION_STATUS_UPDATE_RECEIVER 846aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown */ 847aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown public static final String ACTION_GET_SESSION_STATUS = 848aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown "android.media.intent.action.GET_SESSION_STATUS"; 849aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown 850aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown /** 851aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Remote playback media control action: End session. 852aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <p> 853aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Used with routes that support {@link #CATEGORY_REMOTE_PLAYBACK remote playback} 854aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * media control. 855aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 856aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * This action causes a remote playback route to end the specified session. 857aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * The session becomes no longer valid and the route ceases to be under control 858aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * of the session. 859aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 860aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * If successful, the status of the session is set to 861aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * {@link MediaSessionStatus#SESSION_STATE_ENDED} and a status update is sent to 862aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * the session's status update receiver. 863aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 864aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Additionally, the status of all media items in the queue is set to 865aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * {@link MediaItemStatus#PLAYBACK_STATE_CANCELED canceled} and a status update is sent 866aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * to the appropriate status update receivers indicating the new status of each item. 867aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p> 868aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 869aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <h3>Request parameters</h3> 870aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <ul> 871aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_ID} <em>(required)</em>: Specifies the session id of 872aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * the session to end. 873aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </ul> 874aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 875aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <h3>Result data</h3> 876aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <ul> 877aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_STATUS} <em>(always returned)</em>: Specifies the 878aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * status of the media session. 879aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </ul> 880aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 881aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <h3>Errors</h3> 882aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <p> 883aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * This action returns an error if the session id is unknown or no longer valid. 884aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * In other words, it is an error to attempt to end a session other than the 885aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * current session. 886b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </p><ul> 887b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * <li>{@link #EXTRA_ERROR_CODE} <em>(optional)</em>: Specifies the cause of the error. 888b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </ul> 889aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 890aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see MediaRouter.RouteInfo#sendControlRequest 891aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #CATEGORY_REMOTE_PLAYBACK 892aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown */ 893aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown public static final String ACTION_END_SESSION = "android.media.intent.action.END_SESSION"; 894aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown 895dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim /** 896718625bf6d666a657f8b4e1969f02ef62a21bfc1Sungsoo Lim * Custom media control action: Send {@link #EXTRA_MESSAGE}. 897dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * <p> 89839c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * This action asks a route to handle a message described by EXTRA_MESSAGE. 899dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * </p> 900dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * 901dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * <h3>Request parameters</h3> 902dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * <ul> 903dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * <li>{@link #EXTRA_SESSION_ID} <em>(required)</em>: Specifies the session id of the session 904dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * to which will handle this message. 90539c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * <li>{@link #EXTRA_MESSAGE} <em>(required)</em>: Specifies the message to send. 906dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * </ul> 907dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * 908dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * <h3>Result data</h3> 90939c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * Any messages defined by each media route provider. 910dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * 911dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * <h3>Errors</h3> 91239c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * Any error messages defined by each media route provider. 913dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * 914dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * @see MediaRouter.RouteInfo#sendControlRequest 915dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim */ 91639c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim public static final String ACTION_SEND_MESSAGE = "android.media.intent.action.SEND_MESSAGE"; 917dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim 9183efa63d3b896244713e84acbb5945562dce41d77Jeff Brown /* Extras and related constants. */ 9193efa63d3b896244713e84acbb5945562dce41d77Jeff Brown 920aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown /** 921eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Bundle extra: Media session id. 922eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <p> 923eff7719415542ba819054863b0995f07742a7a8aJeff Brown * An opaque unique identifier that identifies the remote playback media session. 924eff7719415542ba819054863b0995f07742a7a8aJeff Brown * </p><p> 925eff7719415542ba819054863b0995f07742a7a8aJeff Brown * Used with various actions to specify the id of the media session to be controlled. 926de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 927de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * Included in broadcast intents sent to 9283e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * {@link #EXTRA_ITEM_STATUS_UPDATE_RECEIVER item status update receivers} to identify 929eff7719415542ba819054863b0995f07742a7a8aJeff Brown * the session to which the item in question belongs. 93055eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * </p><p> 931aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Included in broadcast intents sent to 932aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * {@link #EXTRA_SESSION_STATUS_UPDATE_RECEIVER session status update receivers} to identify 933aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * the session. 934aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 935de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * The value is a unique string value generated by the media route provider 936eff7719415542ba819054863b0995f07742a7a8aJeff Brown * to represent one particular media session. 937c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p> 938c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 939de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * @see #ACTION_PLAY 940de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * @see #ACTION_SEEK 941de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * @see #ACTION_GET_STATUS 942eff7719415542ba819054863b0995f07742a7a8aJeff Brown * @see #ACTION_PAUSE 943eff7719415542ba819054863b0995f07742a7a8aJeff Brown * @see #ACTION_RESUME 944eff7719415542ba819054863b0995f07742a7a8aJeff Brown * @see #ACTION_STOP 945aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #ACTION_START_SESSION 946aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #ACTION_GET_SESSION_STATUS 947aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #ACTION_END_SESSION 948c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown */ 949eff7719415542ba819054863b0995f07742a7a8aJeff Brown public static final String EXTRA_SESSION_ID = 950eff7719415542ba819054863b0995f07742a7a8aJeff Brown "android.media.intent.extra.SESSION_ID"; 951c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown 952c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown /** 953aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Bundle extra: Media session status. 954aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <p> 955aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Returned as a result from media session actions such as {@link #ACTION_START_SESSION}, 956aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * {@link #ACTION_PAUSE}, and {@link #ACTION_GET_SESSION_STATUS} 957aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * to describe the status of the specified media session. 958aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 959aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Included in broadcast intents sent to 960aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * {@link #EXTRA_SESSION_STATUS_UPDATE_RECEIVER session status update receivers} to provide 961aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * updated status information. 962aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 963aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * The value is a {@link android.os.Bundle} of data that can be converted into 964aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * a {@link MediaSessionStatus} object using 965aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * {@link MediaSessionStatus#fromBundle MediaSessionStatus.fromBundle}. 966aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p> 967aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 968aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #ACTION_PLAY 969aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #ACTION_SEEK 970aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #ACTION_GET_STATUS 971aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #ACTION_PAUSE 972aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #ACTION_RESUME 973aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #ACTION_STOP 974aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #ACTION_START_SESSION 975aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #ACTION_GET_SESSION_STATUS 976aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #ACTION_END_SESSION 977aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown */ 978aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown public static final String EXTRA_SESSION_STATUS = 979aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown "android.media.intent.extra.SESSION_STATUS"; 980aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown 981aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown /** 982dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * Bundle extra: Media session status update receiver. 983aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <p> 984aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Used with {@link #ACTION_START_SESSION} to specify a {@link PendingIntent} for a 985aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * broadcast receiver that will receive status updates about the media session. 986aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 987aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * Whenever the status of the media session changes, the media route provider will 988aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * send a broadcast to the pending intent with extras that identify the session 989aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * id and its updated status. 990aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p><p> 991aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * The value is a {@link PendingIntent}. 992aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </p> 993aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 994aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <h3>Broadcast extras</h3> 995aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <ul> 996aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_ID} <em>(required)</em>: Specifies the session id of 997aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * the session. 998aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * <li>{@link #EXTRA_SESSION_STATUS} <em>(required)</em>: Specifies the status of the 999aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * session as a bundle that can be decoded into a {@link MediaSessionStatus} object. 1000aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * </ul> 1001aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * 1002aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown * @see #ACTION_START_SESSION 1003aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown */ 1004aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown public static final String EXTRA_SESSION_STATUS_UPDATE_RECEIVER = 1005aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown "android.media.intent.extra.SESSION_STATUS_UPDATE_RECEIVER"; 1006aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown 1007aaa9719b402f15df68f9536b813e06dcd9a5d73aJeff Brown /** 100839c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * Bundle extra: Media message receiver. 1009dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * <p> 1010dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * Used with {@link #ACTION_START_SESSION} to specify a {@link PendingIntent} for a 101139c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * broadcast receiver that will receive messages from the media session. 1012dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * </p><p> 101339c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * When the media session has a message to send, the media route provider will 1014dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * send a broadcast to the pending intent with extras that identify the session 1015dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * id and its message. 1016dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * </p><p> 1017dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * The value is a {@link PendingIntent}. 1018dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * </p> 1019dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * 1020dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * <h3>Broadcast extras</h3> 1021dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * <ul> 1022dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * <li>{@link #EXTRA_SESSION_ID} <em>(required)</em>: Specifies the session id of 1023dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * the session. 102439c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * <li>{@link #EXTRA_MESSAGE} <em>(required)</em>: Specifies the message from 1025dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * the session as a bundle object. 1026dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * </ul> 1027dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * 1028dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * @see #ACTION_START_SESSION 1029dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim */ 103039c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim public static final String EXTRA_MESSAGE_RECEIVER = 103139c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim "android.media.intent.extra.MESSAGE_RECEIVER"; 1032dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim 1033dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim /** 1034de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * Bundle extra: Media item id. 1035c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <p> 10363e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * An opaque unique identifier returned as a result from {@link #ACTION_PLAY} or 10373e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * {@link #ACTION_ENQUEUE} that represents the media item that was created by the 10383e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * playback request. 1039de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 1040de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * Used with various actions to specify the id of the media item to be controlled. 1041de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 1042de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * Included in broadcast intents sent to 1043de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * {@link #EXTRA_ITEM_STATUS_UPDATE_RECEIVER status update receivers} to identify 1044de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * the item in question. 1045de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 1046de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * The value is a unique string value generated by the media route provider 1047de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * to represent one particular media item. 1048c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p> 1049c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 1050de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * @see #ACTION_PLAY 10513e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * @see #ACTION_ENQUEUE 1052de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * @see #ACTION_SEEK 1053de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * @see #ACTION_GET_STATUS 1054c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown */ 1055de3d4d3c033fc939af83775a443b295a4034444cJeff Brown public static final String EXTRA_ITEM_ID = 1056de3d4d3c033fc939af83775a443b295a4034444cJeff Brown "android.media.intent.extra.ITEM_ID"; 1057c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown 1058c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown /** 1059de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * Bundle extra: Media item status. 1060c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <p> 1061de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * Returned as a result from media item actions such as {@link #ACTION_PLAY}, 10623e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * {@link #ACTION_ENQUEUE}, {@link #ACTION_SEEK}, and {@link #ACTION_GET_STATUS} 1063eff7719415542ba819054863b0995f07742a7a8aJeff Brown * to describe the status of the specified media item. 1064de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 1065de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * Included in broadcast intents sent to 10663e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * {@link #EXTRA_ITEM_STATUS_UPDATE_RECEIVER item status update receivers} to provide 1067de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * updated status information. 1068de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 1069de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * The value is a {@link android.os.Bundle} of data that can be converted into 1070de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * a {@link MediaItemStatus} object using 1071de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * {@link MediaItemStatus#fromBundle MediaItemStatus.fromBundle}. 1072c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p> 1073c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 1074de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * @see #ACTION_PLAY 10753e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * @see #ACTION_ENQUEUE 1076de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * @see #ACTION_SEEK 1077de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * @see #ACTION_GET_STATUS 1078c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown */ 1079de3d4d3c033fc939af83775a443b295a4034444cJeff Brown public static final String EXTRA_ITEM_STATUS = 1080de3d4d3c033fc939af83775a443b295a4034444cJeff Brown "android.media.intent.extra.ITEM_STATUS"; 1081c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown 1082c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown /** 1083ba811896e3057cb48ad0f017efe1bf0c262430ecJeff Brown * Long extra: Media item content position. 1084c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <p> 10853e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * Used with {@link #ACTION_PLAY} or {@link #ACTION_ENQUEUE} to specify the 10863e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * starting playback position. 1087129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p><p> 1088129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * Used with {@link #ACTION_SEEK} to set a new playback position. 1089129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p><p> 1090ba811896e3057cb48ad0f017efe1bf0c262430ecJeff Brown * The value is a long integer number of milliseconds from the beginning of the content. 1091129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <p> 1092129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * 1093129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * @see #ACTION_PLAY 10943e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * @see #ACTION_ENQUEUE 1095129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * @see #ACTION_SEEK 1096129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown */ 10973d4c9459ed77f732dd3ba602713af6ebf9280c8cJeff Brown public static final String EXTRA_ITEM_CONTENT_POSITION = 109843f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown "android.media.intent.extra.ITEM_POSITION"; 1099129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown 1100129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown /** 110143f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * Bundle extra: Media item metadata. 1102129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * <p> 11033e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * Used with {@link #ACTION_PLAY} or {@link #ACTION_ENQUEUE} to specify metadata 11043e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * associated with the content of a media item. 1105129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p><p> 1106de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * The value is a {@link android.os.Bundle} of metadata key-value pairs as defined 110743f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * in {@link MediaItemMetadata}. 1108c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p> 1109c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 1110c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * @see #ACTION_PLAY 11113e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * @see #ACTION_ENQUEUE 1112c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown */ 111343f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown public static final String EXTRA_ITEM_METADATA = 111443f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown "android.media.intent.extra.ITEM_METADATA"; 1115c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown 1116c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown /** 1117fb75232cb13b19004ec1189888b46767db20daf4Jeff Brown * Bundle extra: HTTP request headers. 1118c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * <p> 11193e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * Used with {@link #ACTION_PLAY} or {@link #ACTION_ENQUEUE} to specify HTTP request 11203e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * headers to be included when fetching to the content indicated by the media 11213e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * item's data Uri. 1122129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p><p> 1123de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * This extra may be used to provide authentication tokens and other 1124de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * parameters to the server separately from the media item's data Uri. 1125129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown * </p><p> 1126de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * The value is a {@link android.os.Bundle} of string based key-value pairs 1127fb75232cb13b19004ec1189888b46767db20daf4Jeff Brown * that describe the HTTP request headers. 1128c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * </p> 1129c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * 1130c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown * @see #ACTION_PLAY 11313e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * @see #ACTION_ENQUEUE 1132c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown */ 1133de3d4d3c033fc939af83775a443b295a4034444cJeff Brown public static final String EXTRA_ITEM_HTTP_HEADERS = 1134de3d4d3c033fc939af83775a443b295a4034444cJeff Brown "android.media.intent.extra.HTTP_HEADERS"; 1135129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown 1136129abf73ce9be1bc172b945263c7975ad1a3006fJeff Brown /** 113743f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * Bundle extra: Media item status update receiver. 113855eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * <p> 11393e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * Used with {@link #ACTION_PLAY} or {@link #ACTION_ENQUEUE} to specify 11403e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * a {@link PendingIntent} for a 1141de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * broadcast receiver that will receive status updates about a particular 1142de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * media item. 114355eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * </p><p> 114443f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * Whenever the status of the media item changes, the media route provider will 11453e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * send a broadcast to the pending intent with extras that identify the session 1146be0f7708a9d53b5bb90a83d551290ebaa01ad32aJeff Brown * to which the item belongs, the session status, the item's id 1147be0f7708a9d53b5bb90a83d551290ebaa01ad32aJeff Brown * and the item's updated status. 1148de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * </p><p> 1149de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * The same pending intent and broadcast receiver may be shared by any number of 1150eff7719415542ba819054863b0995f07742a7a8aJeff Brown * media items since the broadcast intent includes the media session id 1151eff7719415542ba819054863b0995f07742a7a8aJeff Brown * and media item id. 115255eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * </p><p> 115355eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * The value is a {@link PendingIntent}. 115455eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * </p> 115555eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * 115643f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <h3>Broadcast extras</h3> 115743f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * <ul> 1158eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_SESSION_ID} <em>(required)</em>: Specifies the session id of 1159eff7719415542ba819054863b0995f07742a7a8aJeff Brown * the session to which the item in question belongs. 1160be0f7708a9d53b5bb90a83d551290ebaa01ad32aJeff Brown * <li>{@link #EXTRA_SESSION_STATUS} <em>(optional, old implementations may 1161be0f7708a9d53b5bb90a83d551290ebaa01ad32aJeff Brown * omit this key)</em>: Specifies the status of the media session. 1162eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_ID} <em>(required)</em>: Specifies the media item id of the 1163de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * media item in question. 1164eff7719415542ba819054863b0995f07742a7a8aJeff Brown * <li>{@link #EXTRA_ITEM_STATUS} <em>(required)</em>: Specifies the status of the 1165de3d4d3c033fc939af83775a443b295a4034444cJeff Brown * item as a bundle that can be decoded into a {@link MediaItemStatus} object. 116643f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * </ul> 116743f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown * 116855eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown * @see #ACTION_PLAY 11693e472786d3d51c19db5661732ecc13ae3b907db2Jeff Brown * @see #ACTION_ENQUEUE 117055eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown */ 117143f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown public static final String EXTRA_ITEM_STATUS_UPDATE_RECEIVER = 117243f79f79a5117550a7dfedf9c65124afd163ea43Jeff Brown "android.media.intent.extra.ITEM_STATUS_UPDATE_RECEIVER"; 117355eb54486dde6c1eb7857bdfff29f420fb2ecdfbJeff Brown 1174b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown /** 117539c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * Bundle extra: Message. 1176dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * <p> 117739c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * Used with {@link #ACTION_SEND_MESSAGE}, and included in broadcast intents sent to 117839c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * {@link #EXTRA_MESSAGE_RECEIVER message receivers} to describe a message between a 117939c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim * session and a media route provider. 1180dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim * </p><p> 1181718625bf6d666a657f8b4e1969f02ef62a21bfc1Sungsoo Lim * The value is a {@link android.os.Bundle}. 1182718625bf6d666a657f8b4e1969f02ef62a21bfc1Sungsoo Lim * </p> 1183dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim */ 118439c5ca8cf8a45e9c550ef3732e36976b63812593Sungsoo Lim public static final String EXTRA_MESSAGE = "android.media.intent.extra.MESSAGE"; 1185dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim 1186dd5a10666ad2c33be5763215b5859f0298394357Sungsoo Lim /** 1187b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * Integer extra: Error code. 1188b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * <p> 1189b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * Used with all media control requests to describe the cause of an error. 1190b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * This extra may be omitted when the error is unknown. 1191b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </p><p> 1192b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * The value is one of: {@link #ERROR_UNKNOWN}, {@link #ERROR_UNSUPPORTED_OPERATION}, 1193b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * {@link #ERROR_INVALID_SESSION_ID}, {@link #ERROR_INVALID_ITEM_ID}. 1194b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * </p> 1195b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown */ 1196b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown public static final String EXTRA_ERROR_CODE = "android.media.intent.extra.ERROR_CODE"; 1197b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown 1198b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown /** 1199b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * Error code: An unknown error occurred. 1200b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * 1201b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * @see #EXTRA_ERROR_CODE 1202b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown */ 1203b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown public static final int ERROR_UNKNOWN = 0; 1204b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown 1205b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown /** 1206b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * Error code: The operation is not supported. 1207b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * 1208b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * @see #EXTRA_ERROR_CODE 1209b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown */ 1210b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown public static final int ERROR_UNSUPPORTED_OPERATION = 1; 1211b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown 1212b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown /** 1213b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * Error code: The session id specified in the request was invalid. 1214b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * 1215b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * @see #EXTRA_ERROR_CODE 1216b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown */ 1217b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown public static final int ERROR_INVALID_SESSION_ID = 2; 1218b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown 1219b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown /** 1220b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * Error code: The item id specified in the request was invalid. 1221b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * 1222b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown * @see #EXTRA_ERROR_CODE 1223b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown */ 1224b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown public static final int ERROR_INVALID_ITEM_ID = 3; 1225b8b59e000cb7fcd1effc7b5898557b57a7ce0062Jeff Brown 1226c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown private MediaControlIntent() { 1227c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown } 1228c21f57ed68b81a77167f1df000b0e272e1598bc0Jeff Brown} 1229