java.lang.Object | ||
↳ | android.content.BroadcastReceiver | |
↳ | com.google.android.gms.cast.framework.media.MediaIntentReceiver |
A BroadcastReceiver
for receiving media button actions from the status bar notification,
the lock screen, and the cast dialog.
MediaIntentReceiver
can be subclassed to handle custom actions, or override the default
behaviours when handling pre-defined actions. In that case, set the name of the subclass when
building CastMediaOptions
by calling
setMediaIntentReceiverClassName(String)
,
and declare the subclass in your manifest.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | ACTION_DISCONNECT | The action for ending the current session and disconnecting from the receiver app. | |||||||||
String | ACTION_FORWARD | The action for forwarding the current item. | |||||||||
String | ACTION_REWIND | The action for rewinding the current item. | |||||||||
String | ACTION_SKIP_NEXT | The action for skipping to the next item in the queue. | |||||||||
String | ACTION_SKIP_PREV | The action for skipping to the previous item in the queue. | |||||||||
String | ACTION_STOP_CASTING | The action for ending the current session and stopping the receiver app. | |||||||||
String | ACTION_TOGGLE_PLAYBACK | The action for toggling remote media playback. | |||||||||
String | EXTRA_SKIP_STEP_MS | The extra key for specifying how much the currently playing item should be forwarded or
rewinded to handle ACTION_FORWARD and ACTION_REWIND . |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called when
ACTION_FORWARD is received. | |||||||||||
Called when
ACTION_MEDIA_BUTTON is received. | |||||||||||
Called when
ACTION_REWIND is received. | |||||||||||
Called when
ACTION_SKIP_NEXT is received. | |||||||||||
Called when
ACTION_SKIP_PREV is received. | |||||||||||
Called when
ACTION_TOGGLE_PLAYBACK is received. | |||||||||||
Called when other type of actions are received.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
The action for ending the current session and disconnecting from the receiver app.
The action for forwarding the current item. When building an Intent with this action, use
EXTRA_SKIP_STEP_MS
to set the time to forward in milliseconds.
The action for rewinding the current item. When building an Intent with this action, use
EXTRA_SKIP_STEP_MS
to set the time to rewind in milliseconds.
The action for skipping to the next item in the queue.
The action for skipping to the previous item in the queue.
The action for ending the current session and stopping the receiver app.
The action for toggling remote media playback.
The extra key for specifying how much the currently playing item should be forwarded or
rewinded to handle ACTION_FORWARD
and ACTION_REWIND
.
Parameters | |
---|---|
context |
Context
|
intent |
Intent
|
Called when ACTION_FORWARD
is received. The default implementation forwards the
current playing item by forwardStepMs
if currentSession
is a
CastSession
. Subclass can override this method to change the behavior or handle other
type of Session
. Subclass should call through to super to let the SDK handle the
action if currentSession
is a CastSession
Parameters | |
---|---|
currentSession |
Session :
The current Session . |
forwardStepMs |
long :
Time to forward in milliseconds.
|
Called when ACTION_MEDIA_BUTTON
is received. The default implementation
toggles playback state if currentSession
is a CastSession
.
Subclass can override this method to change the behavior or handle other type of
Session
.
Subclass should call through to super to let the SDK handle the action if
currentSession
is a CastSession
Parameters | |
---|---|
currentSession |
Session :
The current Session . |
intent |
Intent :
The Intent of this action.
|
Called when ACTION_REWIND
is received. The default implementation rewinds the
current playing item by rewindStepMs
if currentSession
is a
CastSession
. Subclass can override this method to change the behavior or handle other
type of Session
. Subclass should call through to super to let the SDK handle the
action if currentSession
is a CastSession
Parameters | |
---|---|
currentSession |
Session :
The current Session . |
rewindStepMs |
long :
Time to forward in milliseconds.
|
Called when ACTION_SKIP_NEXT
is received. The default implementation plays the next
item in the queue if currentSession
is a CastSession
and there is a next
item. Subclass can override this method to change the behavior or handle other type of
Session
. Subclass should call through to super to let the SDK handle the action if
currentSession
is a CastSession
Parameters | |
---|---|
currentSession |
Session :
The current Session .
|
Called when ACTION_SKIP_PREV
is received. The default implementation plays the
previous item in the queue if currentSession
is a CastSession
and there is a
previous item. Subclass can override this method to change the behavior or handle other type
of Session
. Subclass should call through to super to let the SDK handle the action if
currentSession
is a CastSession
Parameters | |
---|---|
currentSession |
Session :
The current Session .
|
Called when ACTION_TOGGLE_PLAYBACK
is received. The default implementation toggles
playback state if currentSession
is a CastSession
. Subclass can override this
method to change the behavior or handle other type of Session
.
Subclass should call through to super to let the SDK handle the action if
currentSession
is a CastSession
Parameters | |
---|---|
currentSession |
Session :
The current Session .
|
Called when other type of actions are received. The default implementation does nothing.
Parameters | |
---|---|
action |
String :
The action. |
intent |
Intent :
The Intent of this action.
|