Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

Latest commit

 

History

History
230 lines (165 loc) · 8.56 KB

api.md

File metadata and controls

230 lines (165 loc) · 8.56 KB

Classes

EmpMediaPlayer
EmpReceiverEvents
empReceiver

Events

"METADATA_UPDATED"

Fired when asset metadata has been updated

"STATE_CHANGED"

Fired when receiver state has changed

"RESOLUTION_CHANGED"

Fired when receiver 'resolution has changed - resolution parameter (if null, app should hide UI display element)

EmpMediaPlayer

Kind: global class

new EmpMediaPlayer(receiver)

Implement cast.receiver.media.Player interface

Param Type
receiver empReceiver

EmpReceiverEvents

Kind: global class

new EmpReceiverEvents()

EmpReceiverEvents - Holds receiver events METADATA_UPDATED, STATE_CHANGED, RESOLUTION_CHANGED

empReceiver

Kind: global class

new empReceiver(element, [options], [ready])

empReceiver - Interacts with chromecast and senders

Param Type Description
element String HTML video element id
[options] Object receiver options such as: playerOptions, statusText, controls, debug, messageUrn
[ready] Callback callback to be called when the receiver is reader

empReceiver.state ⇒ string

Current receiver state. ['launching', 'loading','buffering', 'seeking', 'playing', 'paused', 'done', 'idle']

Kind: instance property of empReceiver
Returns: string - empReceiver.ReceiverStates ['launching', 'loading','buffering', 'seeking', 'playing', 'paused', 'done', 'idle']

empReceiver.isChromecast ⇒ bool

Check if running on Chromecast device.

Kind: instance property of empReceiver
Returns: bool - True if running on Chromecast device.

empReceiver.version ⇒ string

EMPReceiver version

Kind: instance property of empReceiver
Returns: string - The EMPReceiver version

empReceiver.player ⇒ EmpPlayer

Returns the underlying EmpPlayer version 2 EmpPlayer API: https://www.npmjs.com/package/empplayer2

Kind: instance property of empReceiver

empReceiver.onMessage(event)

Handle custom message from senders

Kind: instance method of empReceiver

Param Type Description
event cast.receiver.CastMessageBus.Event { data:{ type:'', data:{} } }

empReceiver.onEmpError(error)

Error handler for empPlayer Errors. Broadcast error message to all connected senders.

Kind: instance method of empReceiver

Param Type Description
error string | object error message to broadcast

empReceiver.getMediaInformation() ⇒ cast.receiver.media.MediaInformation

Provides information about the media currently loaded.

Kind: instance method of empReceiver
Returns: cast.receiver.media.MediaInformation - Google Cast MediaInformation.

empReceiver.getMediaManager(safety) ⇒ cast.receiver.MediaManager

Get current media manager instance The MediaManager is used to send/receive media messages/events It will print a warning by default about the danger of using the MediaManager directly but any argument that is passed in will silence the warning.

Kind: instance method of empReceiver
Returns: cast.receiver.MediaManager - Google Cast MediaManager.

Param Type Description
safety any Anything passed in to silence the warning

empReceiver.getCastReceiverManager(safety) ⇒ cast.receiver.CastReceiverManager

Get current cast receiver manager instance The receiver manager allows communication with the platform and is used to send/receive system messages/events.

It will print a warning by default about the danger of using the CastReceiverManager directly but any argument that is passed in will silence the warning.

Kind: instance method of empReceiver
Returns: cast.receiver.CastReceiverManager - Google Cast ReceiverManager.

Param Type Description
safety any Anything passed in to silence the warning

empReceiver.getVideoElement(safety) ⇒ Element

Get current Video Element

It will print a warning by default about the danger of using the Video Element directly but any argument that is passed in will silence the warning.

Kind: instance method of empReceiver
Returns: Element - The Video Element

Param Type Description
safety any Anything passed in to silence the warning

empReceiver.sendMessage(message, opt_senderId)

Sends a custom message to a specific sender or broadcast custom message to all connected senders. It can be dangerous to send message directly from ReceiverApp, but if you know what you're doing it's public.

Kind: instance method of empReceiver

Param Type Description
message object object with message details
opt_senderId string optional set if you want to send message to just one specific sender

empReceiver.sendStatus(opt_senderId, opt_requestId)

Sends media status to a specific sender or broadcast media status to all connected senders.

Kind: instance method of empReceiver

Param Type Description
opt_senderId string optional sender id
opt_requestId number optional request id

"METADATA_UPDATED"

Fired when asset metadata has been updated

Kind: event emitted

"STATE_CHANGED"

Fired when receiver state has changed

Kind: event emitted

"RESOLUTION_CHANGED"

Fired when receiver 'resolution has changed - resolution parameter (if null, app should hide UI display element)

Kind: event emitted