Roblox UtilitiesDevlHub Roblox Documentation

Class

VideoSampler

NotCreatableNotReplicated
Inherits
Object
Memory category
Instances

An object for sampling frames from video content.

This object lets you get image frames from selected timestamps of a video. To create a VideoSampler, call VideoService:CreateVideoSamplerAsync().

Properties 2#

TimeLengthdoubleThe length of the VideoContent in seconds.ReadSafeReadOnlyNotReplicated
VideoContentContentThe asset loaded into the VideoSampler.ReadSafeReadOnlyNotReplicated

TimeLength: double#

ReadOnlyNotReplicatedReadSafe

The length of the VideoContent in seconds.

VideoContent: Content#

ReadOnlyNotReplicatedReadSafe

The asset loaded into the VideoSampler.

Methods 1#

GetSamplesAtTimesAsyncGets image frames at the specified timestamps.Yields

GetSamplesAtTimesAsync(times: Array): List<VideoSample>#

Yields

This method allows you to get a set of image frames from a video at specified timestamps as image Content objects.

NameTypeDefaultDescription
timesArrayAn array of requested timestamps in seconds for which to retrieve image frames. Each timestamp should be a number between 0 and TimeLength.
Returns
  • List<VideoSample> —

    An array of dictionary or nil values for each requested timestamp. If a requested timestamp is out of range or the VideoSampler was unable to produce a sample, the corresponding entry in the returned array will be nil.

    Each dictionary contains the following keys:

    • Time (number): The timestamp of the returned image frame in seconds. This value may differ slightly from the requested timestamp.
    • Image (Content): A Content with a SourceType of ContentSourceType.Opaque containing the image frame at the corresponding timestamp.

Inherited members#

Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed