Class · inherits Instance
VideoPlayer
Used to play video assets.
About VideoPlayer
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
AutoLoadInStudio
: booleanNotReplicatedNotScriptableLoads theVideoContentwhile in Studio Edit mode.By default,
VideoContentdoes not load while in Studio Edit mode and shows no output when wired toVideoDisplayto reduce studio memory usage. Toggle this option to loadVideoContentwhile in Studio Edit mode.AutoPlayInStudio
: booleanNotReplicatedNotScriptablePlays theVideoContentwhile in Studio Edit mode.Plays the
VideoContentwhile in Studio Edit mode.AutoLoadInStudiomust be on for this option to show.IsLoaded
: booleanReadOnlyNotReplicatedIndicates when theVideoContenthas loaded and is ready to play.This property is true when the
VideoContenthas loaded and is ready to play.IsPlaying
: booleanReadOnlyNotReplicatedDenotes whether thisVideoPlayeris currently playing.Denotes whether this
VideoPlayeris currently playing. This property is read-only, but replicates. To play and pause aVideoPlayerat runtime, use thePlay()andPause()methods.Looping
: booleanControls whether thisVideoPlayerloops.Controls whether this
VideoPlayerloops after reaching the end of itsTimeLength.MaximumResolution
: VideoSampleSizeHiddenCaps the resolution of decoded video frames for thisVideoPlayer.The maximum resolution, as an
VideoSampleSizevalue, that the video decoder produces when playing thisVideoPlayer. Defaults toVideoSampleSize.Full, which doesn't limit the decoded resolution. LowerVideoSampleSizevalues reduce the resolution the decoder outputs, which can lower memory usage on constrained devices.PlaybackSpeed
: floatControls the speed at which the video is played.Multiplier that controls how quickly the video plays, directly controlling the perceived pitch of the audio track. Ranges from 0 to 1.
Resolution
: Vector2ReadOnlyNotReplicatedGets the original source resolution of theVideoContentfile.This property gets the original source resolution of the
VideoContentfile.TimeLength
: doubleReadOnlyNotReplicatedIndicates the length of theVideoContentin seconds.This property indicates the length of the
VideoContentin seconds. If the video is not loaded, this value is 0.TimePosition
: doubleIndicates the progress in seconds of theVideoContent.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
: ContentThe asset to be loaded into theVideoPlayer.The content ID of the video file a
VideoPlayerobject is associated with. To save resources and improve performance, call theUnload()method to unload theVideoContentwhen theVideoPlayeris not visible or in use.Volume
: floatControls how loudly the audio track will be played.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
(pin: string) → List<Wire>Returns an array ofWiresthat are connected to the specified pin.Returns an array of
Wiresthat are connected to the specified pin.VideoPlayerhas one "Output" pin.GetInputPins
() → ArrayGets the list of pins thatWirecan use inWire.TargetNameto connect to this instance via itsWire.TargetInstanceproperty.Gets the list of pins that
Wirecan use inWire.TargetNameto connect to this instance via itsWire.TargetInstanceproperty.For
VideoPlayer, there are none.GetOutputPins
() → ArrayGets the list of pins thatWirecan use inWire.SourceNameto connect to this instance via itsWire.SourceInstanceproperty.Gets the list of pins that
Wirecan use inWire.SourceNameto connect to this instance via itsWire.SourceInstanceproperty.For
VideoPlayer, this isOutputonly.LoadAsync
() → AssetFetchStatusYieldsLoads theVideoContentbefore it is played.VideoContentis typically only loaded whenPlay()is called, causing some buffering delay. This function can preloadVideoContentso that it can be immediately played whenPlay()is called. Loading videos can consume a significant amount of device memory.Pause
() → ()Pauses theVideoPlayerwherever itsTimePositionis.Pauses the
VideoPlayerwherever itsTimePositionis. Replicates from server to client.Play
() → ()Plays theVideoPlayerfrom wherever itsTimePositionis.Plays the
VideoPlayerfrom wherever itsTimePositionis. Replicates from server to client. To save resources and improve performance, call theUnload()method to unload theVideoContentwhen theVideoPlayeris not visible or in use.Unload
() → ()Unloads theVideoPlayer.VideoContentto save resources.Unloads the
VideoContentto save resources. After calling this method, theIsLoadedproperty is false, and theTimePositionresets to 0. To play the video again, theLoadAsync()orPlay()method must be called to reload the video.
Events 4
DidEnd
VideoPlayer.DidEnd:Connect(function())Fires when theVideoContenthas completed playback and stopped.Fires after the
VideoPlayerhas completed playback and stopped. Note this event does not fire for videos withLoopedset totruesince it continues playing upon reaching its end. This event also does not fire when the video is stopped before playback has completed; for this, useVideoPlayer.GetPropertyChangedSignalon theIsPlayingproperty.DidLoop
VideoPlayer.DidLoop:Connect(function())Fires when theVideoContentloops.Event that fires after the
VideoPlayerloops. This happens when the video reaches the end of its content. This event does not fire if the video is looped manually by changing itsTimePosition.PlayFailed
VideoPlayer.PlayFailed:Connect(function(error))Fires when theVideoPlayerfails to load or play itsVideoContent.Fires when the
VideoPlayerfails to load or play itsVideoContent. Theerrorparameter is anAssetFetchStatusvalue that describes why the content couldn't be fetched.WiringChanged
VideoPlayer.WiringChanged:Connect(function(connected, pin, wire, instance))Fires when another instance is connected to or disconnected from theVideoPlayervia aWire.Event that fires after a
Wirebecomes connected or disconnected, and thatWireis now or was previously connected to a pin on theVideoPlayerand to some other wirable instance.
VideoPlayer also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.