Platforms to show: All Mac Windows Linux Cross-Platform

Back to AVAssetMBS class.

AVAssetMBS.availableChapterLocales as NSLocaleMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The locales available for chapters in the asset. (read-only)

AVAssetMBS.availableMediaCharacteristicsWithMediaSelectionOptions as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
An array of media characteristics for which a media selection option is available. (read-only)

The value of this property is an array of strings, each string indicating a media characteristic for which a media selection option is available.

AVAssetMBS.availableMetadataFormats as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
An array of strings, each representing a metadata format that's available to the asset. (read-only)

Metadata formats may include ID3, iTunes metadata, and so on. For more details, see AVMetadataItem.

AVAssetMBS.cancelLoading

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Cancels the loading of all values for all observers.

Deallocation of an instance of the asset will implicitly invoke this method if any loading requests are still outstanding.

AVAssetMBS.chapterMetadataGroupsBestMatchingPreferredLanguages as AVTimedMetadataGroupMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of chapters whose locale best matches the the list of preferred languages.

preferredLanguages: Optional, an array of strings, each of which contains a canonicalized IETF BCP 47 language identifier. The order of the identifiers in the array reflects the preferred language order, with the most preferred language being first in the array. Typically, you pass the user's preferred languages by retrieving this array from the preferredLanguages class method of NSLocale. If you don't pass an array, the plugin automatically passes NSLocaleMBS.preferredLanguages.

Returns an array of AVTimedMetadataGroup objects.

Each object in the returned array contains an AVMetadataItem object representing the chapter title. The time range property of the AVTimedMetadataGroup object is equal to the time range of the chapter title item.

All of the available chapter metadata is included in the metadata groups, including items with the common key AVMetadataCommonKeyArtwork, if such items are present. Items not carrying chapter titles are added to an existing AVTimedMetadataGroup object if the time range (timestamp and duration) of the metadata item and that of the metadata group overlaps. The locale of such items need not match the locale of the chapter titles.

You can use the metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages: method to further filter the metadata items in each group. You can also filter the returned items based on locale using the metadataItemsFromArray:withLocale: method.

Special Considerations
Becomes callable without blocking when the data in the availableChapterLocales property is already loaded.

See also:

AVAssetMBS.chapterMetadataGroupsBestMatchingPreferredLanguages(preferredLanguages() as string) as AVTimedMetadataGroupMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of chapters whose locale best matches the the list of preferred languages.

preferredLanguages: Optional, an array of strings, each of which contains a canonicalized IETF BCP 47 language identifier. The order of the identifiers in the array reflects the preferred language order, with the most preferred language being first in the array. Typically, you pass the user's preferred languages by retrieving this array from the preferredLanguages class method of NSLocale. If you don't pass an array, the plugin automatically passes NSLocaleMBS.preferredLanguages.

Returns an array of AVTimedMetadataGroup objects.

Each object in the returned array contains an AVMetadataItem object representing the chapter title. The time range property of the AVTimedMetadataGroup object is equal to the time range of the chapter title item.

All of the available chapter metadata is included in the metadata groups, including items with the common key AVMetadataCommonKeyArtwork, if such items are present. Items not carrying chapter titles are added to an existing AVTimedMetadataGroup object if the time range (timestamp and duration) of the metadata item and that of the metadata group overlaps. The locale of such items need not match the locale of the chapter titles.

You can use the metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages: method to further filter the metadata items in each group. You can also filter the returned items based on locale using the metadataItemsFromArray:withLocale: method.

Special Considerations
Becomes callable without blocking when the data in the availableChapterLocales property is already loaded.

See also:

AVAssetMBS.chapterMetadataGroupsWithTitleLocale(locale as NSLocaleMBS, commonKeys() as string) as AVTimedMetadataGroupMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of chapters with a given title locale and containing specified keys.

locale: The locale of the metadata items carrying chapter titles to be returned (the method supports the IETF BCP 47 specification of locales).
commonKeys: An array of common keys of AVMetadataItem to include in the returned array. AVMetadataCommonKeyArtwork is the only supported key.

Returns an array of AVTimedMetadataGroup objects.

Each object in the returned array contains an AVMetadataItem object representing the chapter title, and the time range property of the AVTimedMetadataGroup object is equal to the time range of the chapter title item.

An AVMetadataItem with the specified common key is added to an existing AVTimedMetadataGroup object if the time range (timestamp and duration) of the metadata item and the metadata group overlap.

The locale of items not carrying chapter titles need not match the specified locale parameter. You can filter the returned items based on locale using metadataItemsFromArray.

AVAssetMBS.commonMetadata as AVMetadataItemMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
An array of metadata items for each common metadata key for which a value is available. (read-only)

The value is an array of AVMetadataItem objects, one for each common metadata key for which a value is available. You can filter the array by locale using metadataItemsFromArray (AVMetadataItem) or by key using metadataItemsFromArray (AVMetadataItem).

AVAssetMBS.Constructor   Private

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The private constructor.

AVAssetMBS.copy as AVAssetMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a copy of the object.

AVAssetMBS.duration as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The duration of the asset. (read-only)
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.mov")
dim a as AVAssetMBS = AVAssetMBS.assetWithFile(f)

MsgBox str(a.duration.Seconds)+" seconds"

If providesPreciseDurationAndTiming is false, a best-available estimate of the duration is returned. You can set the degree of precision required for timing-related properties at initialization time for assets initialized with URLs (see AVURLAssetPreferPreciseDurationAndTimingKey in AVURLAsset).

AVAssetMBS.loadValuesAsynchronouslyForKeys(keys() as string, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Tells the asset to load the values of any of the specified keys that are not already loaded.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.m4v")
dim a as AVAssetMBS = AVAssetmbs.assetWithFile(f)

if a = nil then
MsgBox "failed to read file at all"
Return
end if

// request duration property
a.loadValuesAsynchronouslyForKeys array("duration")

dim e as NSErrorMBS
dim Status as Integer = a.statusOfValueForKey("duration", e)
while status < a.AVKeyValueStatusLoaded
// wait for loading in background
status = a.statusOfValueForKey("duration", e)
wend

// got it?
if status <> a.AVKeyValueStatusLoaded then
MsgBox "Failed to load duration."
if e <> nil then
MsgBox e.LocalizedDescription
end if

else
MsgBox str(a.duration.Seconds)+" seconds long."
end if

keys: An array containing the required keys.

Calls AVFoundationMBS.AssetLoadValuesAsynchronouslyForKeysFinished on completion.
The completion event will be invoked exactly once per invocation of this method:

  • Synchronously if an I/O error or other format-related error occurs immediately.
  • Asynchronously at a subsequent time if a loading error occurs at a later stage of processing, or if cancelLoading is invoked on an AVAsset instance.

The completion states of the keys you specify in keys are not necessarily the same—some may be loaded, and others may have failed. You must check the status of each key individually.

If you want to receive error reporting for loading that's still pending, you can call this method at any time—even after an asset has begun to load data for operations in progress or already completed. If a fatal error has already occurred, the completion event is invoked synchronously.

AVAssetMBS.mediaSelectionGroupForMediaCharacteristic(mediaCharacteristic as string) as AVMediaSelectionGroupMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an AVMediaSelectionGroup object that contains one or more options with the specified media characteristic.

mediaCharacteristic: A media characteristic for which you wish to obtain the available media selection options.
Only AVMediaCharacteristicAudible and AVMediaCharacteristicLegible are currently supported.
Pass AVMediaCharacteristicAudible to obtain the group of available options for audio media in various languages and for various purposes, such as descriptive audio.
Pass AVMediaCharacteristicLegible to obtain the group of available options for subtitles in various languages and for various purposes.

Returns an AVMediaSelectionGroup object that contains one or more options with the media characteristic specified by mediaCharacteristic, or nil if none could be found.

You can invoke this method without blocking when the key availableMediaCharacteristicsWithMediaSelectionOptions has been loaded.
You can filter the options in the returned media selection group according to playability, locale, and additional media characteristics can be accomplished using the filtering methods defined in the AVMediaSelectionGroup class.

AVAssetMBS.metadata as AVMetadataItemMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 14.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Provides access to an array of AVMetadataItems for all metadata identifiers for which a value is available.
Example
// load file and look for cover art

Dim file As FolderItem = SpecialFolder.Desktop.Child("test.m4a")
Dim a As AVURLAssetMBS = AVURLAssetMBS.URLAssetWithFile(file)

Dim iTunesMetadataKeyCoverArtString As String = AVFoundationMBS.AVMetadataiTunesMetadataKeyCoverArt
Dim iTunesMetadataKeyCoverArtNumber As Integer = OSTypeFromStringMBS(iTunesMetadataKeyCoverArtString)

Dim items() As AVMetadataItemMBS = a.metadata

For Each item As AVMetadataItemMBS In items

Dim key As Variant = item.key
Dim Val As Variant = item.value

If key.IntegerValue = iTunesMetadataKeyCoverArtNumber Or key.StringValue = iTunesMetadataKeyCoverArtString Then

Dim v As MemoryBlock = Val
window1.Backdrop = picture.FromData(v)
End If

Next

Available in Mac OS X 10.10.

AVAssetMBS.metadataForFormat(Format as string) as AVMetadataItemMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of AVMetadataItem objects, one for each metadata item in the container of the specified format.

format: The metadata format for which you want items.

Returns an array of AVMetadataItem objects, one for each metadata item in the container of the specified format, or nil if there is no metadata of the specified format.

You can filter the array by locale using metadataItemsFromArray (AVMetadataItem) or by key using metadataItemsFromArray (AVMetadataItem).
Becomes callable without blocking when availableMetadataFormats has been loaded.

AVAssetMBS.naturalSize as CGSizeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The encoded or authored size of the visual portion of the asset.

AVAssetMBS.preferredTransform as CGAffineTransformMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The preferred transform to apply to the visual content of the asset for presentation or processing. (read-only)

The value is often, but not always, the identity transform.

AVAssetMBS.readTimeCodeObjects as AVTimeCodeMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 17.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Reads time codes from asset.

Raises exception if not possible.
Returns empty array if nothing found.

Provides details on time codes.

AVAssetMBS.readTimeCodes as String()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 16.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Reads time codes from asset.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.m4v")
dim a as AVAssetMBS = AVAssetMBS.assetWithFile(f)
dim timecodes() as string = a.readTimeCodes

break // see in debugger

Raises exception if not possible.
Returns empty array if nothing found.

Format is 2 digit hours, double colon, 2 digit minutes, double colon, 2 digit seconds, double colon, 2 digit frames.
e.g. "01:02:03:04"

Please use readTimeCodeObjects for more options.

AVAssetMBS.statusOfValueForKey(key as string, byref error as NSErrorMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Reports whether the value for a given key is immediately available without blocking. (required)
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.m4v")
dim a as AVAssetMBS = AVAssetmbs.assetWithFile(f)

if a = nil then
MsgBox "failed to read file at all"
Return
end if

// request duration property
a.loadValuesAsynchronouslyForKeys array("duration")

dim e as NSErrorMBS
dim Status as Integer = a.statusOfValueForKey("duration", e)
while status < a.AVKeyValueStatusLoaded
// wait for loading in background
status = a.statusOfValueForKey("duration", e)
wend

// got it?
if status <> a.AVKeyValueStatusLoaded then
MsgBox "Failed to load duration."
if e <> nil then
MsgBox e.LocalizedDescription
end if

else
MsgBox str(a.duration.Seconds)+" seconds long."
end if

key: The key whose status you want.
error: If the status of the value for the key is AVKeyValueStatusFailed, upon return contains an NSError object that describes the failure that occurred.

Returns the current loading status of the value for key. For possible values, see "Protocol Methods."

You use this method to determine the availability of the value for a key. This method does not cause an asset to load the value of a key that's not yet available. To request values for keys that may not already be loaded without blocking, use loadValuesAsynchronouslyForKeys and wait for invocation of the completion handler to be informed of availability.

AVAssetMBS.trackGroups as AVAssetTrackGroupMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 14.0 ✅ Yes ❌ No ❌ No ✅ Yes All
An array containing all of the track groups in the asset. (read-only)

This is an array of AVAssetTrackGroup instances, each representing a different grouping of tracks in the asset.
Available in OS X v10.9 and later.

AVAssetMBS.tracks as AVAssetTrackMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The tracks contained by the asset. (read-only)

Tracks are instances of AVAssetTrack.

AVAssetMBS.tracksWithMediaCharacteristic(mediaCharacteristic as string) as AVAssetTrackMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of AVAssetTrack objects of the asset that present media with a specified characteristic.

mediaCharacteristic: The media characteristic according to which receiver filters its asset tracks.
Return san array of AVAssetTrack objects that present media with mediaCharacteristic, or nil if no tracks with the specified characteristic are available.
You can call this method without blocking when tracks has been loaded.

AVAssetMBS.tracksWithMediaType(mediaType as string) as AVAssetTrackMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of the asset tracks of the asset that present media of a specified type.

mediaType: The media type according to which the asset filters its tracks.
Media types are defined in AVAssetTrack.

Returns an array of AVAssetTrack objects of the asset that present media of mediaType.
You can call this method without blocking when tracks has been loaded.

Some examples using this method:

AVAssetMBS.trackWithTrackID(PersistentTrackID as Integer) as AVAssetTrackMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the track with a specified track ID.

trackID: The trackID of the requested asset track.

Returns the track with track ID trackID, or nil if no track with the specified ID is available.
You can call this method without blocking when tracks has been loaded.

AVAssetMBS.unusedTrackID as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an ID that is currently unused by any of the tracks in the asset.

The items on this page are in the following plugins: MBS AVFoundation Plugin.


The biggest plugin in space...