Class
VideoPlayer
NotBrowsable
Used to play video assets.
An instance for playing video assets. It can be connected to a
VideoDisplay via a Wire to show the video and can be connected
to audio instances via a Wire to play the audio track.
Properties 12#
AutoLoadInStudioboolean | Loads the VideoContent while in Studio
Edit mode.Write: RobloxScriptSecurityReadSafeNotReplicatedNotScriptable |
AutoPlayInStudioboolean | Plays the VideoContent while in Studio
Edit mode.Write: RobloxScriptSecurityReadSafeNotReplicatedNotScriptable |
IsLoadedboolean | Indicates when the VideoContent has
loaded and is ready to play.ReadSafeReadOnlyNotReplicated |
IsPlayingboolean | Denotes whether this VideoPlayer is currently playing.ReadSafeReadOnlyNotReplicated |
Loopingboolean | Controls whether this VideoPlayer loops.ReadSafe |
MaximumResolutionVideoSampleSize | Caps the resolution of decoded video frames for this VideoPlayer.ReadSafeHidden |
PlaybackSpeedfloat | Controls the speed at which the video is played.ReadSafe |
ResolutionVector2 | Gets the original source resolution of the
VideoContent file.ReadSafeReadOnlyNotReplicated |
TimeLengthdouble | Indicates the length of the VideoContent
in seconds.ReadSafeReadOnlyNotReplicated |
TimePositiondouble | Indicates the progress in seconds of the
VideoContent.ReadSafe |
VideoContentContent | The asset to be loaded into the VideoPlayer.ReadSafe |
Volumefloat | Controls how loudly the audio track will be played.ReadSafe |
AutoLoadInStudio: boolean#
NotReplicatedNotScriptableWrite: RobloxScriptSecurityReadSafe
By default, VideoContent does not load
while in Studio Edit mode and shows no output when wired to
VideoDisplay to reduce studio memory usage. Toggle this option to
load VideoContent while in Studio Edit
mode.
AutoPlayInStudio: boolean#
NotReplicatedNotScriptableWrite: RobloxScriptSecurityReadSafe
Plays the VideoContent while in Studio
Edit mode. AutoLoadInStudio must be
on for this option to show.
IsLoaded: boolean#
ReadOnlyNotReplicatedReadSafe
This property is true when the
VideoContent has loaded and is ready to
play.
IsPlaying: boolean#
ReadOnlyNotReplicatedReadSafe
Denotes whether this VideoPlayer is currently playing. This
property is read-only, but replicates. To play and pause a
VideoPlayer at runtime, use the Play()
and Pause() methods.
Looping: boolean#
ReadSafe
Controls whether this VideoPlayer loops after reaching the end of
its TimeLength.
MaximumResolution: VideoSampleSize#
HiddenReadSafe
The maximum resolution, as an VideoSampleSize value, that the video
decoder produces when playing this VideoPlayer. Defaults to
VideoSampleSize.Full, which doesn't limit the decoded resolution.
Lower VideoSampleSize values reduce the resolution the decoder
outputs, which can lower memory usage on constrained devices.
PlaybackSpeed: float#
ReadSafe
Multiplier that controls how quickly the video plays, directly controlling the perceived pitch of the audio track. Ranges from 0 to 1.
Resolution: Vector2#
ReadOnlyNotReplicatedReadSafe
This property gets the original source resolution of the
VideoContent file.
TimeLength: double#
ReadOnlyNotReplicatedReadSafe
This property indicates the length of the
VideoContent in seconds. If the video is
not loaded, this value is 0.
TimePosition: double#
ReadSafe
This property indicates the progress in seconds of the
VideoContent. It can be changed to move
the playback position of the video both before and during playback.
VideoContent: Content#
ReadSafe
The content ID of the video file a VideoPlayer object is
associated with. To save resources and improve performance, call the
Unload() method to unload the
VideoContent when the VideoPlayer
is not visible or in use.
Volume: float#
ReadSafe
Volume level, which is multiplied onto the output audio stream, controlling how loudly the audio track plays. Ranges from 0 to 3.
Methods 7#
| GetConnectedWires | Returns an array of Wires that are connected to the specified
pin. |
| GetInputPins | Gets the list of pins that Wire can use in Wire.TargetName
to connect to this instance via its Wire.TargetInstance property. |
| GetOutputPins | Gets the list of pins that Wire can use in Wire.SourceName
to connect to this instance via its Wire.SourceInstance property. |
| LoadAsync | Loads the VideoContent before it is
played.Yields |
| Pause | Pauses the VideoPlayer wherever its
TimePosition is. |
| Play | Plays the VideoPlayer from wherever its
TimePosition is. |
| Unload | Unloads the VideoPlayer.VideoContent to save resources. |
GetConnectedWires(pin: string): List<Wire>#
Returns an array of Wires that are connected to the specified
pin. VideoPlayer has one "Output" pin.
| Name | Type | Default | Description |
|---|---|---|---|
pin | string | An input or output pin on this instance |
Returns
List<Wire>— An array ofWires
GetInputPins(): Array#
Gets the list of pins that Wire can use in Wire.TargetName
to connect to this instance via its Wire.TargetInstance property.
For VideoPlayer, there are none.
Returns
Array— An array of strings representing valid pin names.
GetOutputPins(): Array#
Gets the list of pins that Wire can use in Wire.SourceName
to connect to this instance via its Wire.SourceInstance property.
For VideoPlayer, this is Output only.
Returns
Array— An array of strings representing valid pin names.
LoadAsync(): AssetFetchStatus#
Yields
VideoContent is typically only loaded
when Play() is called, causing some buffering
delay. This function can preload
VideoContent so that it can be
immediately played when Play() is called.
Loading videos can consume a significant amount of device memory.
Returns
AssetFetchStatus— AnAssetFetchStatusdescribing the outcome of the load —AssetFetchStatus.Successonce theVideoContenthas loaded, or a failure status such asAssetFetchStatus.FailureorAssetFetchStatus.TimedOutif it could not be fetched.
Pause(): ()#
Pauses the VideoPlayer wherever its
TimePosition is. Replicates from server
to client.
Returns
()
Play(): ()#
Plays the VideoPlayer from wherever its
TimePosition is. Replicates from server
to client. To save resources and improve performance, call the
Unload() method to unload the
VideoContent when the VideoPlayer
is not visible or in use.
Returns
()
Unload(): ()#
Unloads the VideoContent to save
resources. After calling this method, the
IsLoaded property is false, and the
TimePosition resets to 0. To play the
video again, the LoadAsync() or
Play() method must be called to reload the
video.
Returns
()
Events 4#
| DidEnd | Fires when the VideoContent has completed
playback and stopped. |
| DidLoop | Fires when the VideoContent loops. |
| PlayFailed | Fires when the VideoPlayer fails to load or play its
VideoContent. |
| WiringChanged | Fires when another instance is connected to or disconnected from the
VideoPlayer via a Wire. |
DidEnd()#
Fires after the VideoPlayer has completed playback and stopped.
Note this event does not fire for videos with
Looped set to true since it continues playing
upon reaching its end. This event also does not fire when the video is
stopped before playback has completed; for this, use
VideoPlayer:GetPropertyChangedSignal() on the
IsPlaying property.
DidLoop()#
Event that fires after the VideoPlayer loops. This happens when
the video reaches the end of its content. This event does not fire if
the video is looped manually by changing its
TimePosition.
PlayFailed(error: AssetFetchStatus)#
Fires when the VideoPlayer fails to load or play its
VideoContent. The error parameter is an
AssetFetchStatus value that describes why the content couldn't be
fetched.
| Name | Type | Default | Description |
|---|---|---|---|
error | AssetFetchStatus | An AssetFetchStatus value describing why the
VideoContent failed to load. |
WiringChanged(connected: boolean, pin: string, wire: Wire, instance: Instance)#
Event that fires after a Wire becomes connected or disconnected,
and that Wire is now or was previously connected to a pin on the
VideoPlayer and to some other wirable instance.
| Name | Type | Default | Description |
|---|---|---|---|
connected | boolean | Whether the instance was connected or disconnected. | |
pin | string | The pin on the VideoPlayer that the Wire targets. | |
wire | Wire | The Wire between the VideoPlayer and the other
instance. | |
instance | Instance | The other instance that is or was connected through the Wire. |
Inherited members#
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild