Class Playable

Class Summary

Playable(params)
holds all specific information about each media item to be played in APMPlayer -- To play audio/video in APMPlayer, the creation of a valid Playable is first required. to create a playable, see APMPlayerFactory.getPlayable. Also holds complete metadata for a single playable.
Parameters:
{Object} params
object literal used to create a Playable object -- each of the passed object's attributes needs to match a particular item in Field Detail to be included w/ the Playable. note that the indentifier is the only required field for APM-specific audio.. However for basic playables (non-APM), type is also required.

Method Summary

Field Detail

{string} identifier
[REQUIRED] the ID for the playable (must be unique when creating a playlist). Note that this is really the only required field when creating an APM-specific Playable.
{string} type
[REQUIRED] either 'audio' or 'live_audio' -- Note that this is typically set automatically when using a CustomScheme
{string} flash_server_url
server url to connect to to stream flash (eg rtmp://archivemedia.publicradio.org/)
{string} flash_file_path
file to play over flash_server_url (eg 'mp3:filename_64.mp3')
{string} http_file_path
used for HTML5 audio playback (eg http://ondemand.publicradio.org/filename.mp3) -OR- progressive download pseudo HTML5 playback via flash.
{string} title
optional metadata field.
{string} description
optional metadata field.
{string} detail
optional metadata field.
{string} program
optional metadata field.
{string} host
optional metadata field.
{string} date
optional metadata field.
{string} image_sm
image associated w/ playable (eg used to display in info window when playable plays) -- a small and large were necessary to deal w/ re-sizing issues in IE 7,8
{string} image_lg
image associated w/ playable (eg used to display in info window when playable plays)
{boolean} downloadable
(default true) flag to permit the file to be downloaded. Shows download option and/or presents the file for download if no suitable PlaybackMechanism is present.
{number} buffer_time
amount of time (in seconds) the player should buffer -- default = 3.
{number} duration
the length, in miliseconds of this Playable
{number} position
the current position, in miliseconds for the Playable
{number} percent_played
percentage of the playable that's been played (position/duration)
{number} percent_loaded
percentage of the playable that's been loaded (percent of total duration)

Method Detail

  • clearFlashProperties()
    removes the flash_server_url + flash_file_path so that only the progressive http mechanism is possible.
    playable.clearFlashProperties()
  • {boolean} isCustomScheme()
    a Playable isCustomScheme if it has an identifier that matches one of the custom schemes defined
    playable.isCustomScheme('scheme_name')
    Returns:
    {boolean} true or false
  • {boolean} isEOF()
    a Playable is at the end of the file, return true.
    playable.isEOF()
    Returns:
    {boolean} true or false
  • {boolean} isFlashStreamable()
    returns whether or not flash_server_url + flash_file_path is avail. used to allow/disallow seeking before item loads.
    playable.isFlashStreamable()
    Returns:
    {boolean} true or false
  • {boolean} isValid()
    a Playable isValid if it has an identifier and its type matches one of the valid MediaTypes (either 'audio' or 'live_audio')
    playable.isValid()
    Returns:
    {boolean} true or false
  • reset()
    resets playable's position, percent_played, and percent_loaded back to 0
    playable.reset()
  • setEmptyMembers()
    finds and sets any provided members that are either '', 0, or null -- nothing will be set if passed params are empty or null
    playable.setEmptyMembers({object})
  • setMembers()
    finds and sets any valid key, value pair-- will override anything that currently exists in that field.
    playable.setMembers({object})