Platforms to show: All Mac Windows Linux Cross-Platform

Back to AVAssetMBS class.

AVAssetMBS.assetWithData(Data as MemoryBlock, Options as Dictionary = nil) as AVAssetMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 16.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an AVMovie object from a movie header stored in an data parameter.

data: An Memoryblock/String containing a movie header. We make a copy of that.
options: Dictionary object that contains keys for specifying options for the initialization of the AVMovie object. Currently no keys are defined.
Returns An AVMovie object or nil in case of error.
You can use this method to operate on movie headers that are not stored in files; this might include movie headers on the pasteboard (which do not contain media data). In general you should avoid loading an entire movie file with its media data into an instance of Memoryblock/String! By default, the defaultMediaDataStorage property will be nil and each associated AVMovieTrack's mediaDataStorage property will be nil.
If you want to create an AVMutableMovie from an NSData object and then append sample buffers to any of its tracks, you must first set one of these properties to indicate where the sample data should be written.

See also:

AVAssetMBS.assetWithData(Data as String, Options as Dictionary = nil) as AVAssetMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 16.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an AVMovie object from a movie header stored in an data parameter.
Example
// load movie in memory
dim f as FolderItem = SpecialFolder.Desktop.Child("test.m4v")
dim b as BinaryStream = BinaryStream.Open(f)

// now open it from memory
dim s as string = b.Read(b.Length)
dim m as AVAssetMBS = AVAssetMBS.movieWithData(s)

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

data: An Memoryblock/String containing a movie header. We make a copy of that.
options: Dictionary object that contains keys for specifying options for the initialization of the AVMovie object. Currently no keys are defined.
Returns An AVMovie object or nil in case of error.
You can use this method to operate on movie headers that are not stored in files; this might include movie headers on the pasteboard (which do not contain media data). In general you should avoid loading an entire movie file with its media data into an instance of Memoryblock/String! By default, the defaultMediaDataStorage property will be nil and each associated AVMovieTrack's mediaDataStorage property will be nil.
If you want to create an AVMutableMovie from an NSData object and then append sample buffers to any of its tracks, you must first set one of these properties to indicate where the sample data should be written.

See also:

AVAssetMBS.assetWithFile(file as folderitem) as AVAssetMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an asset for inspection of a media resource.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.mov")
dim a as AVAssetMBS = AVAssetMBS.assetWithFile(f)

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

Some examples using this method:

AVAssetMBS.assetWithURL(URL as string) as AVAssetMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an asset for inspection of a media resource.

AVAssetMBS.available as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether this class is available.

Returns true on Mac OS X 10.7 and newer.

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


The biggest plugin in space...