Page tree
Skip to end of metadata
Go to start of metadata

Avalon Media System provides a simple API interface to allow cross-domain control of a media player embedded in an iframe.

Using this API, client webpages will be able to perform this limited set of operations on the player:

  • Play
  • Pause
  • Toggle auto-replay (loop)
  • Set Current Time (in seconds)
  • Get Current Time (in seconds)

Play, pause, and toggle auto-replay are sent from the parent window to the target child window without parameters:

postMessage({'command': 'play'}, target_domain)

postMessage({'command': 'pause'}, target_domain)

postMessage({'command': 'toggle_loop'}, target_domain)

SetCurrentTime is sent with params:

postMessage({'command': 'set_offset','offset': 123}, target_domain)

GetCurrentTime is sent with no parameters, but requires that a listener be available to hear the server's response, which will look like: data:{'command':'currentTime','currentTime':123}

postMessage({'command': 'get_offset'}, target_domain)

Note: target_domain must be the actual domain of the server from which the Player API is being served. If redirects or permalinks are in place, this might be different from the src of the embedded iframe.

Example API Client
  • No labels