Flash

Flash Media Controller - Wrapper for Flash Media API

Constructor

new Flash(optionsopt, ready)

Create an instance of this Tech.

Parameters:
Name Type Attributes Description
options Object <optional>

The key/value store of player options.

ready Component~ReadyCallback

Callback function to call when the Flash Tech is ready.

Mixes In:
  • FlashRtmpDecorator
  • Tech~SouceHandlerAdditions

Extends

Members

static, constant formats :Object

Flash supported mime types.

featuresFullscreenResize :boolean

Boolean indicating wether the Tech support fullscreen resize control. Resizing plugins using request fullscreen reloads the plugin

Inherited From:

featuresNativeTextTracks :boolean

Boolean indicating wether the Tech supports the native TextTracks. This will help us integrate with native TextTracks if the browser supports them.

Inherited From:

featuresPlaybackRate :boolean

Boolean indicating wether the Tech supports changing the speed at which the video plays. Examples:

  • Set player to play 2x (twice) as fast
  • Set player to play 0.5x (half) as fast
Inherited From:

featuresProgressEvents :boolean

Boolean indicating wether the Tech supports the progress event. This is currently not triggered by video-js-swf. This will be used to determine if Tech#manualProgressOn should be called.

Inherited From:

featuresTimeupdateEvents :boolean

Boolean indicating wether the Tech supports the timeupdate event. This is currently not triggered by video-js-swf. This will be used to determine if Tech#manualTimeUpdates should be called.

Inherited From:

featuresVolumeControl :boolean

Boolean indicating wether the Tech supports volume control.

Inherited From:
Default Value:
  • true

Methods

static checkReady(tech)

The SWF isn't always ready when it says it is. Sometimes the API functions still need to be added to the object. If it's not ready, we set a timeout to check again shortly.

Parameters:
Name Type Description
tech Flash

The instance of the flash tech to check.

static embed(swf, flashVars, params, attributes) → {Element}

Only use for non-iframe embeds.

Parameters:
Name Type Description
swf Object

The videojs-swf object.

flashVars Object

Names and values to use as flash option variables.

params Object

Style parameters to set on the object.

attributes Object

Attributes to set on the element.

Returns:
Element -

The embeded Flash DOM element.

static getEmbedCode(swf, flashVars, params, attributes) → {Element}

Only use for non-iframe embeds.

Parameters:
Name Type Description
swf Object

The videojs-swf object.

flashVars Object

Names and values to use as flash option variables.

params Object

Style parameters to set on the object.

attributes Object

Attributes to set on the element.

Returns:
Element -

The embeded Flash DOM element.

static isSupported() → {boolean}

Check if the Flash tech is currently supported.

Returns:
boolean -
  • True if the flash tech is supported.
       - False otherwise.

static onError(swfID, The) → {MediaError|undefined}

Log errors from the swf on the Flash tech.

Parameters:
Name Type Description
swfID number

The id of the swf that had an error.

The string

error string The error to set on the Flash Tech.

Returns:
MediaError | undefined -
  • Returns a MediaError when err is 'srcnotfound'
       - Returns undefined otherwise.

static onEvent(swfID, eventName)

Trigger events from the swf on the Flash Tech.

Parameters:
Name Type Description
swfID number

The id of the swf that had the event

eventName string

The name of the event to trigger

static onReady()

Called when the the swf is "ready", and makes sure that the swf is really ready using Flash#checkReady

static version() → {Array}

Get the current version of Flash that is in use on the page.

Returns:
Array -

an array of versions that are available.

addRemoteTextTrack(options, manualCleanupopt) → {HTMLTrackElement}

Creates a remote text track object and returns an html track element.

Note: This can be an emulated HTMLTrackElement or a native one.

Parameters:
Name Type Attributes Default Description
options Object

See Tech#createRemoteTextTrack for more detailed properties.

manualCleanup boolean <optional>
true
  • When false: the TextTrack will be automatically removed from the video
       element whenever the source changes
     - When True: The TextTrack will have to be cleaned up manually
Returns:
HTMLTrackElement -

An Html Track Element.

Inherited From:
Deprecated:
  • The default functionality for this function will be equivalent to "manualCleanup=false" in the future. The manualCleanup parameter will also be removed.

addTextTrack(kind, labelopt, languageopt) → {TextTrack}

Create and returns a remote TextTrack object.

Parameters:
Name Type Attributes Description
kind string

TextTrack kind (subtitles, captions, descriptions, chapters, or metadata)

label string <optional>

Label to identify the text track

language string <optional>

Two letter language abbreviation

Returns:
TextTrack -

The TextTrack that gets created.

Inherited From:

addWebVttScript_()

Emulate TextTracks using vtt.js if necessary

Fires:
Inherited From:

audioTracks() → {AudioTrackList}

Get the Techs AudioTrackList.

Returns:
AudioTrackList -

The audio track list that the Tech is currently using.

Inherited From:

autoplay() → {boolean}

Get the value of autoplay from the swf. autoplay indicates that the media should start to play as soon as the page is ready.

Returns:
boolean -
  • The value of autoplay from the swf.
      - True indicates that the media ashould start as soon as the page loads.
      - False indicates that the media should not start as soon as the page loads.

buffered() → {TimeRange}

Get and create a TimeRange object for buffering.

Returns:
TimeRange -

The time range object that was created.

Overrides:

bufferedPercent() → {number}

Get the percentage of the current video that is currently buffered.

Returns:
number -

A number from 0 to 1 that represents the decimal percentage of the video that is buffered.

Inherited From:

cleanupAutoTextTracks()

Remove any TextTracks added via addRemoteTextTrack that are flagged for automatic garbage collection

Inherited From:

clearTracks(types)

Clear out a single TrackList or an array of TrackLists given their names.

Note: Techs without source handlers should call this between sources for video & audio tracks. You don't want to use them between tracks!

Parameters:
Name Type Description
types Array.<string> | string

TrackList names to clear, valid names are video, audio, and text.

Inherited From:

controller() → {string}

Get the value of controller from the swf.

Returns:
string -

The current value of controller on the swf.

controls() → {boolean}

Get the value of controls from the swf. controls indicates whether the native flash controls should be shown or hidden.

Returns:
boolean -
  • The value of controls from the swf.
      - True indicates that native controls should be showing.
      - False indicates that native controls should be hidden.

controls() → {boolean}

Get the value of controls from the swf. controls indicates whether the native flash controls should be shown or hidden.

Returns:
boolean -
  • The value of controls from the swf.
      - True indicates that native controls should be showing.
      - False indicates that native controls should be hidden.

createEl() → {Element}

Create the Flash Tech's DOM element.

Returns:
Element -

The element that gets created.

createRemoteTextTrack(options) → {HTMLTrackElement}

Create an emulated TextTrack for use by addRemoteTextTrack

This is intended to be overridden by classes that inherit from Tech in order to create native or custom TextTracks.

Parameters:
Name Type Description
options Object

The object should contain the options to initialize the TextTrack with.

Properties
Name Type Attributes Description
kind string <optional>

TextTrack kind (subtitles, captions, descriptions, chapters, or metadata).

label string <optional>

Label to identify the text track

language string <optional>

Two letter language abbreviation.

Returns:
HTMLTrackElement -

The track element that gets created.

Inherited From:

currentTime() → {number}

Get the current playback time in seconds

Returns:
number -

The current time of playback in seconds.

defaultMuted() → {boolean}

Get the value of defaultMuted from the swf. defaultMuted indicates whether the media should start muted or not. Only changes the default state of the media. muted and defaultMuted can have different values. muted indicates the current state.

Returns:
boolean -
  • The value of defaultMuted from the swf.
      - True indicates that the media should start muted.
      - False indicates that the media should not start muted.

defaultPlaybackRate() → {number}

Get the value of defaultPlaybackRate from the swf.

Returns:
number -

The current value of defaultPlaybackRate on the swf.

dispose()

Turn off all event polyfills, clear the Techs AudioTrackList, VideoTrackList, and TextTrackList, and dispose of this Tech.

Fires:
Inherited From:

duration() → {number}

Get the total duration of the current media.

Returns:
number -

8 The total duration of the current media.

ended() → {boolean}

Get the value of ended from the swf. ended indicates whether the media has reached the end or not.

Returns:
boolean -
  • True indicates that the media has ended.
      - False indicates that the media has not ended.
See:

enterFullScreen() → {boolean}

Flash does not allow fullscreen through javascript so this always returns false.

Returns:
boolean -

The Flash tech does not support fullscreen, so it will always return false.

error(erropt) → {MediaError|null}

Get or set an error on the Tech.

Parameters:
Name Type Attributes Description
err MediaError <optional>

Error to set on the Tech

Returns:
MediaError | null -

The current error object on the tech, or null if there isn't one.

Inherited From:

initialTime() → {number}

Get the value of initialTime from the swf.

Returns:
number -

The initialTime proprety on the swf.

initTextTrackListeners()

Turn on listeners for TextTrackList events. This adds EventTarget~EventListeners for texttrackchange, addtrack and removetrack.

Fires:
Inherited From:

initTrackListeners()

Turn on listeners for VideoTrackList and {AudioTrackList events. This adds EventTarget~EventListeners for addtrack, and removetrack.

Fires:
Inherited From:

load()

Load media into Tech.

loop() → {boolean}

Get the value of loop from the swf. loop indicates that the media should return to the start of the media and continue playing once it reaches the end.

Returns:
boolean -
  • The value of loop from the swf.
      - True indicates that playback should seek back to start once
        the end of a media is reached.
      - False indicates that playback should not loop back to the start when the
        end of the media is reached.

manualProgressOff()

Turn off the polyfill for progress events that was created in Tech#manualProgressOn

Inherited From:

manualProgressOn()

Polyfill the progress event for browsers that don't support it natively.

Inherited From:
See:

manualTimeUpdatesOff()

Turn off the polyfill for timeupdate events that was created in Tech#manualTimeUpdatesOn

Inherited From:

manualTimeUpdatesOn()

Polyfill the timeupdate event for browsers that don't support it.

Inherited From:
See:

mediaGroup() → {string}

Get the value of mediaGroup from the swf.

Returns:
string -

The current value of mediaGroup on the swf.

muted() → {boolean}

Get the value of the muted from the swf. muted indicates the current audio level should be silent.

Returns:
boolean -
  • True if the audio should be set to silent
      - False otherwise

networkState() → {number}

Get the value of networkState from the swf. networkState indicates the current network state. It returns an enumeration from the following list:

  • 0: NETWORK_EMPTY
  • 1: NEWORK_IDLE
  • 2: NETWORK_LOADING
  • 3: NETWORK_NO_SOURCE
Returns:
number -

The value of networkState from the swf. This will be a number from the list in the description.

onDurationChange(event)

Update our internal duration on a durationchange event by calling Tech#duration.

Parameters:
Name Type Description
event EventTarget~Event

The durationchange event that caused this to run.

Listens to Events:
  • Tech#event:durationchange
Inherited From:

pause()

Called by Player#pause to pause using the Flash Tech.

paused() → {boolean}

Get the value of paused from the swf. paused indicates whether the swf is current paused or not.

Returns:
boolean -

The value of paused from the swf.

play()

Called by Player#play to play using the Flash Tech.

playbackRate() → {number}

Get the value of playbackRate from the swf. playbackRate indicates the rate at which the media is currently playing back. Examples:

  • if playbackRate is set to 2, media will play twice as fast.
  • if playbackRate is set to 0.5, media will play half as fast.
Returns:
number -

The value of playbackRate from the swf. A number indicating the current playback speed of the media, where 1 is normal speed.

played() → {TimeRange}

Returns the TimeRanges that have been played through for the current source.

NOTE: This implementation is incomplete. It does not track the played TimeRange. It only checks wether the source has played at all or not.

Returns:
TimeRange -
  • A single time range if this video has played
      - An empty set of ranges if not.
Inherited From:

poster()

Get the poster image that was set on the tech.

preload() → {string}

Get the value of preload from the swf. preload indicates what should download before the media is interacted with. It can have the following values:

  • none: nothing should be downloaded
  • metadata: poster and the first few frames of the media may be downloaded to get media dimensions and other metadata
  • auto: allow the media and metadata for the media to be downloaded before interaction
Returns:
string -

The value of preload from the swf. Will be 'none', 'metadata', or 'auto'.

readyState() → {number}

Get the value of readyState from the swf. readyState indicates the current state of the media element. It returns an enumeration from the following list:

  • 0: HAVE_NOTHING
  • 1: HAVE_METADATA
  • 2: HAVE_CURRENT_DATA
  • 3: HAVE_FUTURE_DATA
  • 4: HAVE_ENOUGH_DATA
Returns:
number -

The value of readyState from the swf. This will be a number from the list in the description.

readyState() → {number}

Get the value of readyState from the swf. readyState indicates the current state of the media element. It returns an enumeration from the following list:

  • 0: HAVE_NOTHING
  • 1: HAVE_METADATA
  • 2: HAVE_CURRENT_DATA
  • 3: HAVE_FUTURE_DATA
  • 4: HAVE_ENOUGH_DATA
Returns:
number -

The value of readyState from the swf. This will be a number from the list in the description.

remoteTextTrackEls() → {HTMLTrackElementList}

Get The Techs {HTMLTrackElementList}, which are the elements in the DOM that are being used as TextTracks.

Returns:
HTMLTrackElementList -

The current HTML track elements that exist for the tech.

Inherited From:

remoteTextTracks() → {TextTrackList}

Get the Techs remote TextTrackList, which is created from elements that were added to the DOM.

Returns:
TextTrackList -

The remote text track list that the Tech is currently using.

Inherited From:

removeRemoteTextTrack(track)

Remove a remote text track from the remote TextTrackList.

Parameters:
Name Type Description
track TextTrack

TextTrack to remove from the TextTrackList

Inherited From:

abstract reset()

Reset the tech, which will removes all sources and reset the internal readyState.

Inherited From:

rtmpConnection() → {string}

Get the value of rtmpConnection from the swf.

Returns:
string -

The current value of rtmpConnection on the swf.

rtmpStream() → {string}

Get the value of rtmpStream from the swf.

Returns:
string -

The current value of rtmpStream on the swf.

seekable() → {TimeRange}

Determine the time ranges that can be seeked to in the media.

Returns:
TimeRange -

Returns the time ranges that can be seeked to.

seeking() → {boolean}

Indicates whether the media is currently seeking to a new position or not.

Returns:
boolean -
  • True if seeking to a new position
      - False otherwise

setAutoplay(autoplay)

Set the value of autoplay on the swf. autoplay indicates that the media should start to play as soon as the page is ready.

Parameters:
Name Type Description
autoplay boolean
  • The value of autoplay from the swf.
     - True indicates that the media ashould start as soon as the page loads.
     - False indicates that the media should not start as soon as the page loads.

setController(controller)

Set the value of controller on the swf.

Parameters:
Name Type Description
controller string

New value the current value of controller on the swf.

setCurrentTime(time)

Returns the current time in seconds that the media is at in playback.

Parameters:
Name Type Description
time number

Current playtime of the media in seconds.

Overrides:

setDefaultMuted(defaultMuted)

Set the value of defaultMuted on the swf. defaultMuted indicates whether the media should start muted or not. Only changes the default state of the media. muted and defaultMuted can have different values. muted indicates the current state.

Parameters:
Name Type Description
defaultMuted boolean
  • True indicates that the media should start muted.
      - False indicates that the media should not start muted.

setDefaultPlaybackRate(defaultPlaybackRate)

Set the value of defaultPlaybackRate on the swf.

Parameters:
Name Type Description
defaultPlaybackRate number

New value to set the defaultPlaybackRate property to.

setLoop(loop)

Set the value of loop on the swf. loop indicates that the media should return to the start of the media and continue playing once it reaches the end.

Parameters:
Name Type Description
loop boolean
  • True indicates that playback should seek back to start once
       the end of a media is reached.
     - False indicates that playback should not loop back to the start when the
       end of the media is reached.

setMediaGroup(mediaGroup)

Set the value of mediaGroup on the swf.

Parameters:
Name Type Description
mediaGroup string

New value of mediaGroup to set on the swf.

setMuted(muted)

Set the value of the muted on the swf. muted indicates that the current audio level should be silent.

Parameters:
Name Type Description
muted boolean
  • True if the audio should be set to silent
      - False otherwise

setPlaybackRate(playbackRate)

Set the value of playbackRate on the swf. playbackRate indicates the rate at which the media is currently playing back. Examples:

  • if playbackRate is set to 2, media will play twice as fast.
  • if playbackRate is set to 0.5, media will play half as fast.
Parameters:
Name Type Description
playbackRate number

New value of playbackRate on the swf. A number indicating the current playback speed of the media, where 1 is normal speed.

setPoster()

Poster images are not handled by the Flash tech so make this is a no-op.

Overrides:

setPreload(preload)

Set the value of preload on the swf. preload indicates what should download before the media is interacted with. It can have the following values:

  • none: nothing should be downloaded
  • metadata: poster and the first few frames of the media may be downloaded to get media dimensions and other metadata
  • auto: allow the media and metadata for the media to be downloaded before interaction
Parameters:
Name Type Description
preload string

The value of preload to set on the swf. Should be 'none', 'metadata', or 'auto'.

setRtmpConnection(rtmpConnection)

Set the value of rtmpConnection on the swf.

Parameters:
Name Type Description
rtmpConnection string

New value to set the rtmpConnection property to.

setRtmpStream(rtmpStream)

Set the value of rtmpStream on the swf.

Parameters:
Name Type Description
rtmpStream string

New value to set the rtmpStream property to.

setSrc(srcopt) → {Tech~SourceObject|undefined}

A getter/setter for the Flash Tech's source object.

Parameters:
Name Type Attributes Description
src Tech~SourceObject <optional>

The source object you want to set on the Flash techs.

Returns:
Tech~SourceObject | undefined -
  • The current source object when a source is not passed in.
      - undefined when setting

setVolume(percentAsDecimal)

Set the value of the volume on the swf. volume indicates the current audio level as a percentage in decimal form. This means that 1 is 100%, 0.5 is 50%, and so on.

Parameters:
Name Type Description
percentAsDecimal number

The volume percent as a decimal. Value will be between 0-1.

src(srcopt) → {Tech~SourceObject|undefined}

A getter/setter for the Flash Tech's source object.

Note: Please use Flash#setSource

Parameters:
Name Type Attributes Description
src Tech~SourceObject <optional>

The source object you want to set on the Flash techs.

Returns:
Tech~SourceObject | undefined -
  • The current source object when a source is not passed in.
      - undefined when setting
Deprecated:
  • Since version 5.

startOffsetTime() → {number}

Get the value of startOffsetTime from the swf.

Returns:
number -

The startOffsetTime proprety on the swf.

stopTrackingCurrentTime()

Stop the interval function created in Tech#trackCurrentTime so that the timeupdate event is no longer triggered.

Listens to Events:
  • {Tech#event:pause}
Inherited From:

stopTrackingProgress()

Turn off the polyfill for progress events that was created in Tech#manualProgressOn Stop manually tracking progress events by clearing the interval that was set in Tech#trackProgress.

Inherited From:

supportsFullScreen() → {boolean}

Get fullscreen support -

Flash does not allow fullscreen through javascript so this always returns false.

Returns:
boolean -

The Flash tech does not support fullscreen, so it will always return false.

textTracks() → {TextTrackList}

Get the Techs TextTrackList.

Returns:
TextTrackList -

The text track list that the Tech is currently using.

Inherited From:

trackCurrentTime()

Sets up an interval function to track current time and trigger timeupdate every 250 milliseconds.

Listens to Events:
  • Tech#event:play
Inherited From:

trackProgress(event)

This is used to trigger a progress event when the buffered percent changes. It sets an interval function that will be called every 500 milliseconds to check if the buffer end percent has changed.

This function is called by Tech#manualProgressOn

Parameters:
Name Type Description
event EventTarget~Event

The ready event that caused this to run.

Fires:
Listens to Events:
Inherited From:

videoTracks() → {VideoTrackList}

Get the Techs VideoTrackList.

Returns:
VideoTrackList -

The video track list that the Tech is currently using.

Inherited From:

videoWidth() → {number}

Get the value of videoWidth from the swf. videoWidth indicates the current width of the media in css pixels.

Returns:
number -

The value of videoWidth from the swf. This will be a number in css pixels.

volume() → {number}

Get the value of the volume from the swf. volume indicates the current audio level as a percentage in decimal form. This means that 1 is 100%, 0.5 is 50%, and so on.

Returns:
number -

The volume percent as a decimal. Value will be between 0-1.

Type Definitions

PartsObject

The flash parts object that contains connection and stream info.

Properties:
Name Type Description
connection string

The connection string of a source, defaults to an empty string.

stream string

The stream string of the source, defaults to an empty string.

Events

audiotrackchange

Triggered when tracks are added or removed on the Tech AudioTrackList

Type:
Inherited From:

progress

See Player#progress

Type:
Inherited From:

texttrackchange

Triggered when tracks are added or removed on the Tech TextTrackList

Type:
Inherited From:

timeupdate

Triggered at an interval of 250ms to indicated that time is passing in the video.

Type:
Overrides:

videotrackchange

Triggered when tracks are added or removed on the Tech VideoTrackList

Type:
Inherited From:

vttjsloaded

Fired when vtt.js is loaded.

Type:
Overrides: