Skip to content
marisademeglio edited this page May 17, 2012 · 14 revisions

Functions

fetch(options)

options.url: an absolute path to a SMIL file

Load the file (but don't start playback yet).

findNodeByTextSrc(src)

src: a text document URL, optionally including a fragment identifier

TODO will this be absolute or relative? Or should we try to accommodate both?

Returns the node object containing that src, or null.

play(node)

node: a SMIL node to start playback from

Used for initializing SMIL playback. To start at a specific point, use findNodeByTextSrc to find the node, and then pass it to this function. If node is null, then playback will start at the beginning of the file.

pause()

Pause the audio

resume()

Resume the audio

escape()

Escape the current structure. If the current structure's epub:type value is not in the list of types which may be escaped, then this command is ignored and normal playback continues.

addSkipType(type)

Add an epub:type value to the list of items which must be skipped by the player.

removeSkipType(type)

Remove an epub:type value from the list of items which must be skipped by the player.

addEscapeType(type)

Add an epub:type value to the list of items which may be escaped by the user.

removeEscapeType(type)

Remove an epub:type value from the list of items which may be escaped by the user.

Observable variables

current_text_document_url

string

Base URL portion of the text src of the active SMIL text node (i.e. without the fragment identifier).

TODO: should this be absolute or relative? It will be relative in the SMIL file itself; should we resolve it before broadcasting?

current_text_element_id

string

Fragment identifier portion of the text src of the active SMIL text node. Could also be an empty string if not in use.

is_ready

boolean

Indicates that the file is loaded and ready to play.

is_playing

boolean

Indicates whether audio is playing or not.

should_highlight

boolean

Default: true

Indicates whether the text should be highlighted or not. This is purely a user preference which is not changed internally by the Media Overlays player.

is_document_done

boolean

Indicates that playback of the file has completed.

can_escape

boolean

Indicates that the currently-playing structure may be escaped by the user.