MediaRouter.OnPrepareTransferListener
public
static
interface
MediaRouter.OnPrepareTransferListener
androidx.mediarouter.media.MediaRouter.OnPrepareTransferListener |
Listener for receiving events when the selected route is about to be changed.
Summary
Public methods | |
---|---|
abstract
ListenableFuture<Void>
|
onPrepareTransfer(MediaRouter.RouteInfo fromRoute, MediaRouter.RouteInfo toRoute)
Implement this to handle transfer seamlessly. |
Public methods
onPrepareTransfer
public abstract ListenableFuture<Void> onPrepareTransfer (MediaRouter.RouteInfo fromRoute, MediaRouter.RouteInfo toRoute)
Implement this to handle transfer seamlessly.
Setting the listener will defer stopping the previous route, from which you may get the media status to resume media seamlessly on the new route. When the transfer is prepared, set the returned future to stop media being played on the previous route and release resources. This method is called on the main thread.
MediaRouter.Callback.onRouteUnselected(MediaRouter, RouteInfo, int)
and
MediaRouter.Callback.onRouteSelected(MediaRouter, RouteInfo, int)
are called after
the future is done.
Parameters | |
---|---|
fromRoute |
MediaRouter.RouteInfo : The route that is about to be unselected. |
toRoute |
MediaRouter.RouteInfo : The route that is about to be selected. |
Returns | |
---|---|
ListenableFuture<Void> |
A ListenableFuture whose completion indicates that the
transfer is prepared or null to indicate that no preparation is needed.
If a future is returned, until the future is completed,
the media continues to be played on the previous route.
|