Constructor: MediaCache

OpenAjax.a11y.cache.MediaCache

new MediaCache(dom_cache)

Creates cache object representing information related to audio, video and other media objects in a document

Parameters:
Name Type Description
dom_cache DOMCache Reference to the DOMCache object
Properties:
Name Type Description
dom_cache DOMCache Reference to the DOMCache object
up_to_date Boolean Boolean true if the cache has been creating using the current DOMElements, else false NOTE: This is a common property of all caches and is used when selectively build caches based on whether a rule needs the cache
media_elements Array List of media element objects in the document
length Number Number of media element objects in the list
sort_property String Image element object property the list of media objects is sorted by
sort_ascending Boolean true if list is sorted in ascending order, otherwise false
rule_summary_result ResultRuleSummary Rule results associated with this cache
Source:
  • scripts/cache_media.js, line 46

Methods

<static> addMediaElement(media_element) → {Number}

Adds a media element object to the list of media elements and generates a cache id for the object.

Parameters:
Name Type Description
media_element MediaElement media element object to add
Source:
  • scripts/cache_media.js, line 86
Returns:
Returns the length of the list of media element objects
Type
Number

<static> emptyCache()

Resests the media cache object properties and empties all the lists and arrays

Source:
  • scripts/cache_media.js, line 160

<static> getItemByCacheId(cache_id) → {MediaElement|null}

Finds the the media element object with the matching cache id

Parameters:
Name Type Description
cache_id String Cache id of media element object
Source:
  • scripts/cache_media.js, line 133
Returns:
Returns cache media element object if cache id is found, otherwise null
Type
MediaElement | null

<static> getMediaElementByCacheId(cache_id) → {MediaElement|null}

Finds the the media element object with the matching cache id

Parameters:
Name Type Description
cache_id String Cache id of media element object
Source:
  • scripts/cache_media.js, line 117
Returns:
Returns cache media element object if cache id is found, otherwise null
Type
MediaElement | null

<static> sortMediaElements(property, ascending) → {Boolean}

Sorts media element array by a media element object property

Parameters:
Name Type Description
property String Property of media element object to sort the list
ascending Boolean true if sort in ascending order; false in descending order
Source:
  • scripts/cache_media.js, line 288
Returns:
Returns true if list was sorted, false if not
Type
Boolean

<static> traverseDOMElementsForMediaElements(dom_element, media_info)

Traverses DOMElement objects in the tree to update the media cache

Parameters:
Name Type Description
dom_element DOMElement dom element object to check for inclusion in media cache
media_info MediaInfo information about a media elements
Source:
  • scripts/cache_media.js, line 233

<static> updateCache()

Traverses the DOMElements to update the media cache NOTE: This function is only used when the specialized caches are build as rules need them. In this condition, if the rules dependent on the media cache are disabled, this cache would not be updated

Source:
  • scripts/cache_media.js, line 262

<static> updateCacheItems(dom_element, media_info)

Updates the media cache by checking to see if a dom element should be added to the cache

Parameters:
Name Type Description
dom_element DOMElement dom element object to check for inclusion in media cache
media_info MediaInfo Information about the current media element relationships in the DOM
Source:
  • scripts/cache_media.js, line 181