Skip to end of metadata
Go to start of metadata

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

idstringThe transport ID event
statusstring

Specifies whether the event was handled, handled with an error, or unhandled. This may be one of the following values:

Value

Description

"unhandled"The channel is not handling the event. The default behavior is executed by the firmware, if defined.
"error"The channel failed to handle the event in that instance.
"error.ad"The transport command failed because an ad is playing.
"error.channel"The channel does not support this command in any context.
"error.live"The transport command failed because the content is live.
"error.no-media"

There is no media active.

"error.redundant"

The transport command does change the current state ("pause" command sent when the content is already paused)

"success"The channel handled the event successfully.
"success.seek-start"

A seek command was handled successfully, but the seek duration was before the beginning.

"success.seek-end"

A seek command was handled successfully but the seek location was past the end.

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.

  • No labels