The singleton class as the entry point of the Cast TV SDK.
Nested Class Summary
class | CastReceiverContext.EventCallback | Callback class for observing various events. | |
interface | CastReceiverContext.MessageReceivedListener | Listener for listening messages that come from the sender. |
Public Method Summary
staticCastReceiverContext |
getInstance()
Returns the shared instance.
|
MediaManager |
getMediaManager()
Returns the
MediaManager .
|
CastReceiverOptions |
getReceiverOptions()
Returns the receiver options.
|
SenderInfo | |
Collection<SenderInfo> |
getSenders()
Returns all senders.
|
static void | |
void |
registerEventCallback(CastReceiverContext.EventCallback
callback)
Registers a
CastReceiverContext.EventCallback
|
void | |
void | |
void |
setMessageReceivedListener(Stringnamespace,
CastReceiverContext.MessageReceivedListenerlistener)
Sets a listener for a given namespace.
|
void |
start()
Tells the Cast TV SDK that the receiver app has started and is ready to accept
commands.
|
void |
stop()
Tells the Cast TV SDK that the receiver app has stopped and won't accept
commands any more.
|
void |
unregisterEventCallback(CastReceiverContext.EventCallback
callback)
Unregisters a
CastReceiverContext.EventCallback
|
Inherited Method Summary
Public Methods
public staticCastReceiverContext getInstance()
Returns the shared instance. Returnsnull
if the instance hasn't been
initialized.
publicMediaManager getMediaManager()
Returns theMediaManager
.
publicCastReceiverOptions getReceiverOptions()
Returns the receiver options.
publicSenderInfo getSender(StringsenderId)
Returns theSenderInfo
with the givensenderId
.Returnsnull
if not found.
publicCollection<SenderInfo> getSenders()
Returns all senders.
public static voidinitInstance(Context context)
Initializes the shared instance.
public voidregisterEventCallback(CastReceiverContext.EventCallback callback)
Registers a
CastReceiverContext.EventCallback
public voidremoveMessageReceivedListener(String namespace)
Removes a listener for a given namespace.
public voidsendMessage(Stringnamespace,StringsenderId,Stringmessage)
Sends a message to a specific sender.
Parameters
namespace | the namespace. Note that a valid namespace has to be prefixed with the string 'urn:x-cast:' |
---|---|
senderId | the sender Id, ornull for broadcast to all senders |
message | the message |
public voidsetMessageReceivedListener(Stringnamespace, CastReceiverContext.MessageReceivedListenerlistener)
Sets a listener for a given namespace.
Will replace a listener for the namespace if there is one.
public voidstart()
Tells the Cast TV SDK that the receiver app has started and is ready to accept commands.
TheMediaCommandCallback
and
CastReceiverContext.MessageReceivedListener
will be invoked if new messages
arrive.
public voidstop()
Tells the Cast TV SDK that the receiver app has stopped and won't accept commands any more.
TheMediaCommandCallback
and
CastReceiverContext.MessageReceivedListener
will no longer be invoked.
public voidunregisterEventCallback(CastReceiverContext.EventCallback callback)
Unregisters a
CastReceiverContext.EventCallback