Implemented By
Supported Methods
Description of Methods
GetMessagePort() as Object
Returns the message port (if any) currently associated with the object.
SetMessagePort(port as Object) as Void
Set the roMessagePort to be used to receive events.
EnableTransportEvents()
Registers a channel to receive roInput transport events, which are voice commands sent via the Roku voice remote, Roku mobile app, or a virtual assistant such as Amazon Alexa or Google Assistant. Voice commands include the following: "play", "pause", "stop", "forward", "next", "rewind", "replay", "seek", and "startover". Once you register your channel to receive transport events, your channel must call the EventResponse() method to handle them.
Only one roInput object may receive transport events. If multiple roInput objects call the EnableTransportEvents() function, only the last roInput object will receive the events. Each EnableTransportEvents() call puts the roInput on a stack. If an roInput object is deleted and therefore removed from the stack, the next roInput object on the stack becomes the active one.
Transport events are only for handling voice commands. Keypresses from the Roku remote control or Roku mobile app must be handled separately.
See Implementing transport controls for more information.
EventResponse(roAssociativeArray aa)
Marks a transport command as handled, unhandled, or handled with an error. This method takes an AssociativeArray with two fields: id and status. The id field is an integer that specifies the transport ID event; the status specifies whether the event was handled, handled with an error, or unhandled:
Field | Type | Description | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | string | The transport ID event | ||||||||||||||||||||||
status | string | Specifies whether the event was handled, handled with an error, or unhandled. This may be one of the following values:
|
If your channel has registered for handling transport events (by calling the EnableTransportEvents() function on an roInput object), it should call this method immediately after receiving a transport event. This is because the Roku firmware needs to know whether a transport command has been handled, unhandled, or handled with an error.
If a transport event is marked as unhandled, the Roku firmware can provide the default behavior. If a transport event is marked as handled with an error, the Roku firmware can provide on-screen feedback.
If your channel has registered for transport events, but does not call this method within 5 seconds of receiving a transport event, the event is considered unhandled.