Platforms to show: All Mac Windows Linux Cross-Platform

Back to AVAssetTrackMBS class.

AVAssetTrackMBS.associatedTracksOfType(trackAssociationType as string) as AVAssetTrackMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 14.0 ✅ Yes ❌ No ❌ No ✅ Yes All
An array containing other tracks associated with the track using the specified association type.

trackAssociationType: The association type for which associated tracks are requested.

Returns an array of AVAssetTrack objects associated with the track by trackAssociationType. May be empty if no tracks are associated through the specified association type.

You can call this method without blocking after availableTrackAssociationTypes has been loaded.
Available in OS X v10.9 and later.

AVAssetTrackMBS.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 containing the metadata formats available for the track. (read-only)

The array contains String objects, one for each metadata format that's available for the track (such as QuickTime user data). For possible values, see AVMetadataItem.

AVAssetTrackMBS.availableTrackAssociationTypes as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 14.0 ✅ Yes ❌ No ❌ No ✅ Yes All
An array of association types used to associate other tracks with the track. (read-only)

The array contains strings, one for each type of association for which the track has associated tracks. For possible values, see "Track Association Types" in Apple's documentation.
Available in OS X v10.9 and later.

AVAssetTrackMBS.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 AVMetadataItem objects for each common metadata key for which a value is available. (read-only)

AVAssetTrackMBS.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.

AVAssetTrackMBS.copy as AVAssetTrackMBS

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.

AVAssetTrackMBS.formatDescriptions as CMFormatDescriptionMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The formats of media samples referenced by the track. (read-only)

The array contains CMFormatDescriptions, each of which indicates the format of media samples referenced by the track. A track that presents uniform media (for example, encoded according to the same encoding settings) will provide an array with a count of 1.

AVAssetTrackMBS.hasMediaCharacteristic(mediaCharacteristic as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value that indicates whether the track references media with the specified media characteristic.

mediaCharacteristic: The media characteristic of interest.
For possible values, see "Media Characteristics" in AV Foundation Constants Reference, for example AVMediaCharacteristicVisual, AVMediaCharacteristicAudible, or AVMediaCharacteristicLegible.

Returns true if the track references media with the specified characteristic, otherwise false.

AVAssetTrackMBS.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.

keys: An array containing the required keys.

Calls AVFoundationMBS.AssetTrackLoadValuesAsynchronouslyForKeysFinished 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.

AVAssetTrackMBS.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
An array of metadata items, one for each metadata item in the container of the specified format.

format: The metadata format for which items are requested.

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

You can call this method without blocking after availableMetadataFormats has been loaded.

AVAssetTrackMBS.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 transform specified in the track's storage container as the preferred transformation of the visual media data for display purposes. (read-only)

The value of this property is often, but not always, CGAffineTransformIdentity.

AVAssetTrackMBS.samplePresentationTimeForTrackTime(trackTime as CMTimeMBS) as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Maps the specified track time through the appropriate time mapping and returns the resulting sample presentation time.

trackTime: The track time for which a sample presentation time is requested.
Returns the sample presentation time corresponding to trackTime; the value will be invalid if trackTime is out of range.

AVAssetTrackMBS.segmentForTrackTime(trackTime as CMTimeMBS) as AVAssetTrackSegmentMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The track segment that corresponds to the specified track time.

trackTime: The track time for which you want the segment.
Returns the track segment from the segments array that corresponds to trackTime, or nil if trackTime is out of range.

AVAssetTrackMBS.segments as AVAssetTrackSegmentMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The time mappings from the track's media samples to the timeline of the track. (read-only)

The array contains instances of AVAssetTrackSegment.

Empty edits (that is, time ranges for which no media data is available to be presented) have source.start and source.duration equal to kCMTimeInvalid.

AVAssetTrackMBS.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)

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.

AVAssetTrackMBS.timeRange as CMTimeRangeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The time range of the track within the overall timeline of the asset. (read-only)

A track with CMTimeCompare(timeRange.start, kCMTimeZero) == 1 will initially present an empty time range.

AVAssetTrackMBS.trackSamples(formatOptions as Dictionary) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 15.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Queries the track Samples
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.m4v")
dim a as AVAssetMBS = AVAssetMBS.assetWithFile(f)
dim tracks() as AVAssetTrackMBS = a.tracksWithMediaType(AVFoundationMBS.AVMediaTypeAudio)
dim track as AVAssetTrackMBS = tracks(0)

dim d as new Dictionary
dim n as Integer = OSTypeFromStringMBS(AVFoundationMBS.kAudioFormatLinearPCM)
d.Value(AVFoundationMBS.AVFormatIDKey) = n
d.Value(AVFoundationMBS.AVLinearPCMBitDepthKey) = 16
d.Value(AVFoundationMBS.AVLinearPCMIsBigEndianKey) = false
d.Value(AVFoundationMBS.AVLinearPCMIsFloatKey) = false
d.Value(AVFoundationMBS.AVLinearPCMIsNonInterleaved) = false

dim SampleData as MemoryBlock = track.trackSamples(d)

window1.Backdrop = RenderSamplesMBS(SampleData, SampleData.Size / 2, 1, window1.Width, window1.Height, 1, &c88B5C4, &c274C5A, &c203F4E, 15)

Returns nil in case of errors.
Track should be an audio or muxed track.

Some examples using this method:

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


The biggest plugin in space...