Roblox UtilitiesDevlHub Roblox Documentation

Class

VideoFrame

Inherits
GuiObject › GuiBase2d › GuiBase › Instance › Object
Memory category
Gui

A GUI object that renders a rectangle, like a Frame does, with a moving video image.

A VideoFrame renders a rectangle, like a Frame does, with a moving video image. The video must be from a file uploaded to the Roblox website.

The video is scaled to fit the entirety of the rectangle, but looks best when displayed at its native resolution.

2D and 3D Sound#

A VideoFrame placed underneath SurfaceGui on a BasePart will emit its sound from that part's BasePart.Position.

A VideoFrame exhibits the Doppler effect, meaning its frequency and pitch varies with the relative motion of whatever part it is attached to.

The volume of the VideoFrame will be determined by the distance between the client's sound listener (by default the Camera position) and the position of the VideoFrame's part.

A VideoFrame is considered "global" if it is not placed underneath SurfaceGui on a BasePart. In this case, the sound will play at the same volume throughout the entire place.

Properties 13#

IsLoadedbooleanIndicates when the VideoFrame.Video has loaded from Roblox servers and is ready to play.ReadSafeReadOnlyNotReplicated
LoopedbooleanSets whether or not the VideoFrame.Video repeats once it has finished when it is playing.ReadSafe
MaximumResolutionVideoSampleSizeInternal-only. Caps the resolution the video is allowed to stream at, expressed as an VideoSampleSize.ReadSafeHidden
PlayingbooleanIndicates whether the VideoFrame.Video is currently playing. It can be set to start or pause playback.ReadSafeNotReplicated
ResolutionVector2Gets the original source resolution of the VideoFrame.Video file.ReadSafeReadOnlyNotReplicated
RollOffMaxDistancefloatThe maximum distance, in studs, a listener can be from the video's part and still hear its audio.ReadSafe
RollOffMinDistancefloatThe minimum distance, in studs, at which the video's audio starts to attenuate.ReadSafe
RollOffModeRollOffModeControls how the video's audio volume attenuates with distance.ReadSafe
TimeLengthdoubleIndicates the length of the VideoFrame.Video in seconds.ReadSafeReadOnlyNotReplicated
TimePositiondoubleIndicates the progress in seconds of the VideoFrame.Video.ReadSafeNotReplicated
VideoContentIdThe content ID of the video file a VideoFrame object is associated with.ReadSafe
VideoContentContentThe video content a VideoFrame is associated with, as either an asset content ID (same value as Video) or a direct reference to a VideoCapture object for local screen recordings.ReadSafe
VolumefloatIndicates how loud the VideoFrame.Video is currently playing back.ReadSafe

IsLoaded: boolean#

ReadOnlyNotReplicatedReadSafe

This property will be true when the VideoFrame.Video has loaded from Roblox servers and is ready to play.

Looped: boolean#

ReadSafe

This property sets whether or not the VideoFrame.Video repeats once it has finished when it is playing.

MaximumResolution: VideoSampleSize#

HiddenReadSafe

Internal-only. Caps the resolution the video is allowed to stream at, as an VideoSampleSize rather than exact pixel dimensions.

The video may still stream below the cap on a slow connection. Defaults to VideoSampleSize.Full.

Playing: boolean#

NotReplicatedReadSafe

This property indicates whether the VideoFrame.Video is currently playing. It can be set to start or pause playback as an alternative to the VideoFrame:Play() and VideoFrame:Pause() functions.

Resolution: Vector2#

ReadOnlyNotReplicatedReadSafe

This property gets the original source resolution of the VideoFrame.Video file.

RollOffMaxDistance: float#

ReadSafe

The maximum distance, in studs, a client's listener can be from the VideoFrame's part and still hear its audio. Defaults to 10000.

This property only affects playback when the VideoFrame is 3D, as described in the class's "2D and 3D Sound" section; it has no effect on a global VideoFrame. How RollOffMaxDistance affects the attenuation of the sound depends on the RollOffMode property.

RollOffMinDistance: float#

ReadSafe

The minimum distance, in studs, at which the VideoFrame's audio begins to attenuate (decrease in volume). Defaults to 1.

This property only affects playback when the VideoFrame is 3D, as described in the class's "2D and 3D Sound" section; it has no effect on a global VideoFrame. How RollOffMinDistance affects the attenuation of the sound depends on the RollOffMode property.

RollOffMode: RollOffMode#

ReadSafe

Controls how the volume of the VideoFrame's audio attenuates (fades out) as the distance between the listener and the video's part changes. Defaults to RollOffMode.Inverse.

This property only affects playback when the VideoFrame is 3D, as described in the class's "2D and 3D Sound" section; it has no effect on a global VideoFrame. For details on the different modes, see RollOffMode.

TimeLength: double#

ReadOnlyNotReplicatedReadSafe

This property indicates the length of the VideoFrame.Video in seconds. If the video is not loaded, this value will be 0.

TimePosition: double#

NotReplicatedReadSafe

This property indicates the progress in seconds of the VideoFrame.Video. It can be changed to move the playback position of the video both before and during playback.

Video: ContentId#

ReadSafe

The content ID of the video file a VideoFrame object is associated with. To save resources and improve performance, set this property to "" when the VideoFrame is not visible or in use.

VideoContent: Content#

ReadSafe

The video content a VideoFrame object is associated with. Setting this property is equivalent to setting Video, and reading it returns a content ID equal to Video.

When referencing a video by content ID, build the value with the corresponding Content constructor: Content.fromAssetId() for a numeric asset ID, or Content.fromUri() for an rbxassetid:// URI.

Unlike Video, which only accepts a content ID string, VideoContent can also hold a direct reference to a VideoCapture object, such as one retrieved through CaptureService:ReadCapturesFromGalleryAsync(). This lets a local screen recording play back on the VideoFrame without first uploading it to Roblox. Build the value with Content.fromObject(), for example videoFrame.VideoContent = Content.fromObject(capture).

Volume: float#

ReadSafe

This property determines how loud the VideoFrame.Video plays back. It can be set to a number between 0 and 100.

Methods 2#

PauseSets VideoFrame.Playing to false, pausing playback if the VideoFrame.Video is playing.
PlaySets VideoFrame.Playing to true, playing the VideoFrame.Video from the current VideoFrame.TimePosition.

Pause(): ()#

Sets VideoFrame.Playing to false, pausing playback if the VideoFrame.Video is playing.

As VideoFrame.TimePosition is not reset, when the video is resumed it will continue from its previous position.

Returns
  • ()

Play(): ()#

Sets VideoFrame.Playing to true, playing the VideoFrame.Video from the current VideoFrame.TimePosition. To save resources and improve performance, set the VideoFrame.Video property to "" when the VideoFrame is not visible or in use.

Returns
  • ()

Events 5#

DidLoopFires whenever the VideoFrame.Video loops.
EndedFires when the VideoFrame.Video has completed playback and stopped.
LoadedFires when the VideoFrame.Video is loaded.
PausedThis event fires whenever the VideoFrame.Video is paused using VideoFrame:Pause() or by setting VideoFrame.Playing to false.
PlayedFires whenever the VideoFrame.Video is played using the VideoFrame:Play() function or by setting VideoFrame.Playing to true.

DidLoop(video: string)#

An event that fires whenever the VideoFrame.Video loops. Returns the content ID of the video.

NameTypeDefaultDescription
videostringThe content ID of the video that looped.

Ended(video: string)#

This event fires when the VideoFrame.Video has completed playback and stopped.

NameTypeDefaultDescription
videostringThe content ID of the paused that ended.

Loaded(video: string)#

This event fires when the VideoFrame.Video is loaded.

NameTypeDefaultDescription
videostringThe content ID of the loaded video.

Paused(video: string)#

This event fires whenever the VideoFrame.Video is paused using VideoFrame:Pause() or by setting VideoFrame.Playing to false.

NameTypeDefaultDescription
videostringThe content ID of the paused video.

Played(video: string)#

This event fires whenever the VideoFrame.Video is played using the VideoFrame:Play() function or by setting VideoFrame.Playing to true.

NameTypeDefaultDescription
videostringThe content ID of the played video.

Inherited members#

Inherited from GuiObject 51
Inherited from GuiBase2d 12
Inherited from Instance 58
Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed