MediaAsset
abstract class VideoKit.Assets.MediaAsset
A media asset refers to a media file on the file system. It provides methods for social sharing and other common tasks that are performed on audio, video, and images.
Creating a Media Asset
The media asset is always created from a set of factory methods:
From a File
The media asset can be created from a file path
.
This also supports blob://
URLs in WebGL.
From a Texture
An ImageAsset
can be created from a texture
.
The texture
MUST be readable.
From Plain Text
A TextAsset
can be created from plain text
.
From an Audio Clip
An AudioAsset
can be created from an audio clip
.
From the Camera Roll
A MediaAsset
can be created by prompting the user to select an image or video from the camera roll. Below is an example:
This method is not supported, and returns null
, on macOS and Windows.
Accessing the Media Path
This is the path
to the recorded media file on the file system.
On WebGL, this is a blob URL with form blob:...
Sharing a Media Asset
The media asset can be shared using the native sharing UI. An optional message
can be attached to the sharing UI.
Most apps will not be able to share the media asset if it includes a message
, so only add one if you know what you're doing.
Native sharing is not supported and does nothing on WebGL or Windows.
Saving to the Camera Roll
The media asset can be saved to the camera roll. An optional album
can be specified.
On WebGL, this method will download the asset to the user's device.
Saving to the camera roll is not supported on macOS or Windows.
Deleting the Asset
The media asset can be deleted on disk.
Prefer using this method over System.IO.File.Delete
because it will properly handle deleting the file from browser memory on WebGL.
Last updated