Class: HEIFReader

HEIFReader

new HEIFReader(url)

HEIF file reader object.
Parameters:
Name Type Description
url string URL of the HEIF file for reading.
Source:

Classes

FileInfo

Methods

getCompatibleBrands() → {Array.<string>}

Source:
Returns:
Compatible brands list from the File Type Box
Type
Array.<string>

getCoverImageItemId(contextId) → {number}

Get the ID of the primary frame of the frame source. This is the default frame to display.
Parameters:
Name Type Description
contextId number Context ID of a track / root-level metabox.
Source:
Returns:
Item ID of the primary frame of the frame source.
Type
number

getDecoderParameters(contextId, itemId) → {Uint8Array}

Get VPS, SPS and PPS of given item concatenated as a sigle Uint8Array.
Parameters:
Name Type Description
contextId number Context ID of a track / root-level metabox.
itemId number Item ID of the requested item.
Source:
Returns:
Decoder parameter data.
Type
Uint8Array

getDisplayHeight(contextId) → {number}

Get maximum display height from track headers.
Parameters:
Name Type Description
contextId number Context ID of a track.
Source:
Returns:
Maximum display height in pixels.
Type
number

getDisplayWidth(contextId) → {number}

Get maximum display width from track headers.
Parameters:
Name Type Description
contextId number Context ID of a track.
Source:
Returns:
Maximum display width in pixels.
Type
number

getItemData(contextId, itemId) → {Uint8Array}

Parameters:
Name Type Description
contextId number Context ID of a track / root-level metabox.
itemId number ItemId can be any image item/sample in the metabox/track designated by the contextId.
Source:
Returns:
Item data of given item.
Type
Uint8Array

getItemDataWithDecoderParameters(contextId, itemId) → {Uint8Array}

Parameters:
Name Type Description
contextId number Context ID of a track / root-level metabox.
itemId number ItemId can be any image item/sample in the metabox/track designated by the contextId.
Source:
Returns:
Item data with decoder parameters of given item.
Type
Uint8Array

getItemDecodeDependencies(contextId, itemId) → {Uint32Array}

Parameters:
Name Type Description
contextId number Context ID of a track / root-level metabox.
itemId number ItemId can be any image item/sample in the metabox/track designated by the contextId.
Source:
Returns:
Decode dependencies of given item.
Type
Uint32Array

getItemGrid(contextId, itemId)

Get data for item of type Image grid for given (contextId, itemId) pair.
Parameters:
Name Type Description
contextId number Context ID of a track / root-level metabox.
itemId number ItemId can be any image item/sample in the metabox/track designated by the contextId.
Source:
See:
  • getItemIovl()

getItemHeight(contextId, itemId) → {number}

Parameters:
Name Type Description
contextId number Context ID of a track / root-level metabox.
itemId number itemId can be any image item/sample in the metabox/track designated by the contextId.
Source:
Returns:
Height of the given item.
Type
number

getItemIovl(contextId, itemId)

Get data for item of type Image overlay for given (contextId, itemId) pair.
Parameters:
Name Type Description
contextId number Meta box context id
itemId number Id of Image overlay item
Source:
Returns:
IovlItem struct with requested data.

getItemListByType(contextId, type)

Parameters:
Name Type Description
contextId number Context ID of a track / root-level metabox.
type string If contextId refers to a MetaBox then itemType can be the following: 'master' , 'hidden', 'pre-computed', 'hvc1', 'iovl', 'grid', 'Exif', 'mime', 'hvt1' ('master' is ('hvc1' - iref('thmb') or iref('auxl'))) If the contextId refers to a media track; then itemType can be the following: 'out_ref' : output reference frames 'out_non_ref' : output non-reference frames 'non_out_ref' : non-output reference frame 'display' : all frame samples in the track which are displayed and in display order 'samples' : all samples in the track in track's entry order
Source:
Returns:
  • list of items in the container with the ID contextId having the requested itemType as Uint32Array.
  • Found items. The order of the itemIds are as present in the file. An empty vector if no items are found.

getItemProperties(contextId, itemId)

Get properties of an item
Parameters:
Name Type Description
contextId number Context ID to operate in. Must be a meta box.
itemId number Item ID which properties to get.
Source:

getItemsInDecodingOrder(contextId) → {Array.<HEIFReader~ItemTimestamp>}

Get items in decoding order. If the resource pointed by contextId is a media track, then timestamp is read from the track with ID contextId and sample with ID equal to itemId. If the resource is a metabox, a forced generation of timestamps can be done by defining a forced FPS.
Parameters:
Name Type Description
contextId number Track or metabox context id.
Source:
Returns:
ItemTimestamp array sorted in decoding order. Also complete decoding dependencies are listed here. If an item ID is present as a decoding dependency for a succeeding frame, its timestamp is set to 0xffffffff.
Type
Array.<HEIFReader~ItemTimestamp>

getItemTimestamps(contextId) → {Array.<HEIFReader~ItemTimestamp>}

Get display timestamp for each item. If the resource pointed by contextId is a media track, then timestamps are read from the track sample data. If the resource is a metabox, a forced generation of timestamps can be done by defining a forced FPS and a forced tickspersecond.
Parameters:
Name Type Description
contextId number Context ID of a track.
Source:
Returns:
ItemTimestamp array sorted by timestamps.
Type
Array.<HEIFReader~ItemTimestamp>

getItemType(contextId, itemId)

Get itemType of the item pointed by (contextId, itemId) pair The order of the itemIds are as present in the file
Parameters:
Name Type Description
contextId number Track or metabox context id.
itemId number Track or metabox sample/item id.
Source:
Returns:
The itemType of the item pointed by (contextId, itemId) pair. If the context is a metabox, can be the following: 'master' , 'hidden', 'pre-computed', 'hvc1', 'iovl', 'grid', 'Exif', 'mime', 'hvt1', 'iden' ('master' is ('hvc1' - iref('thmb') or iref('auxl')))' If the context is a media track sample description entry type is returned.

getItemWidth(contextId, itemId) → {number}

Parameters:
Name Type Description
contextId number Context ID of a track / root-level metabox.
itemId number itemId can be any image item/sample in the metabox/track designated by the contextId.
Source:
Returns:
Width of the given item.
Type
number

getMajorBrand() → {string}

Source:
Returns:
Major brand from the File Type Box
Type
string

getPlaybackDurationInSecs(contextId) → {number}

Get playback duration of image sequence or media track in seconds. This considers also edit lists.
Parameters:
Name Type Description
contextId number Context ID of a track.
Source:
Returns:
The playback duration of image sequence or media track in seconds. Returns (# of displayable master images)/(forced framerate), if a forced sequential playback is signaled by calling SetForcedTimedPlayback() for a metabox. Returns 0 for an image collection or other items.
Type
number

getPropertyAuxc()

Get item property Auxiliary ('auxC')
Source:
See:
  • getPropertyAuxc()

getPropertyClap()

Get item property Clean aperture ('clap')
Source:
See:
  • getPropertyIrot()

getPropertyIrot(contextId, index)

Get item property Image Rotation ('irot')
Parameters:
Name Type Description
contextId number Meta box context id.
index number Index of the property. This value is given by getItemProperties().
Source:

getPropertyRloc()

Get item property Relative Location ('rloc')
Source:
See:
  • getPropertyIrot()

getReferencedFromItemListByType(contextId, fromItemId, referenceType)

Get list of referenced items for item with (contextId, itemId) pair having the requested referenceType.
Parameters:
Name Type Description
contextId number The context id.
fromItemId number Id of the item referenced from.
referenceType string Can be the following: 'thmb', 'cdcs', 'auxl', 'dimg', 'base' ('master' is ('hvc1' - iref('thmb') or iref('auxl')))
Source:
Returns:
itemIds List of referenced items for item with (contextId, itemId) pair having the requested referenceType. The order of the itemIds are as present in the file. An empty vector if no items are found.

getReferencedToItemListByType(contextId, toItemId, referenceType, itemIds)

Get the list of referenced items for item with (contextId, itemId) pair having the requested referenceType.
Parameters:
Name Type Description
contextId number The context id.
toItemId number Id of the item referenced to.
referenceType string Can be the following: 'thmb', 'cdcs', 'auxl', 'dimg', 'base' ('master' is ('hvc1' - iref('thmb') or iref('auxl')))
itemIds Found items. The order of the itemIds are as present in the file. An empty vector if no items are found.
Source:

getTimestampsOfItem(contextId, itemId)

Get display timestamps for an item. An item may be displayed many times based on the edit list. If the resource pointed by contextId is a media track, then timestamp is read from the track with ID contextId and sample with ID equal to itemId. If the resource is a metabox, a forced generation of timestamps can be done by defining a forced FPS and a forced tickspersecond.
Parameters:
Name Type Description
contextId number Context ID of a track / root-level metabox.
itemId number Id of the item.
Source:

requestFileInfo() → {FileInfo}

Source:
Returns:
FileInfo object as a callback parameter.
Type
FileInfo

setForcedLoopPlayback(contextId, forceLoopPlayback)

Set the forced loop playback mode for an image sequence/samples in metabox/track.
Parameters:
Name Type Description
contextId number Context ID of a track.
forceLoopPlayback boolean True = set forced loop playback on, false = set forced loop playback off.
Source:

setForcedTimedPlayback(contextId, forcedFps)

Set the forced timed playback mode for an image sequence in metabox. If the resource pointed by contextId is a media track, then the values are ignored. If the resource is a metabox, a forced generation of timestamps can be done by defining a forced FPS.
Parameters:
Name Type Description
contextId number Context ID of a track.
forcedFps number Frames per second.
Source:

url() → {string}

Source:
Returns:
The url.
Type
string

Type Definitions

ItemTimestamp

Type:
  • object
Properties:
Name Type Description
t number Timestamp in milliseconds.
id number Id of the item.
Source: