Task<System.Byte[]> CreateVideo( float secondsLength, Sandbox.VideoWriter/Config config )

book_4_sparkGenerated
code_blocksInput

Description

The CreateVideo method in the Editor.Assets.AssetPreview class is responsible for generating a video preview of an asset. This method is asynchronous and returns a Task<byte[]>, which contains the video data in byte array format once the task is completed.

Usage

To use the CreateVideo method, you need to specify the duration of the video in seconds and provide a configuration object of type Sandbox.VideoWriter/Config. The method will process the asset preview and generate a video of the specified length using the provided configuration settings.

Example

// Example usage of CreateVideo method
public async Task<byte[]> GenerateAssetPreviewVideo(float duration, Sandbox.VideoWriter.Config config)
{
    // Create an instance of AssetPreview
    var assetPreview = new Editor.Assets.AssetPreview();
    
    // Generate the video
    byte[] videoData = await assetPreview.CreateVideo(duration, config);
    
    // Return the video data
    return videoData;
}