VideoFrame
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.
코드 샘플
local screenPart = Instance.new("Part")
screenPart.Parent = workspace
local surfaceGui = Instance.new("SurfaceGui")
surfaceGui.Parent = screenPart
local videoFrame = Instance.new("VideoFrame")
videoFrame.Parent = surfaceGui
videoFrame.Looped = true
videoFrame.Video = "rbxassetid://" -- add an asset ID to this
while not videoFrame.IsLoaded do
task.wait()
end
videoFrame:Play()
요약
속성
Indicates when the VideoFrame.Video has loaded from Roblox servers and is ready to play.
Sets whether or not the VideoFrame.Video repeats once it has finished when it is playing.
Indicates whether the VideoFrame.Video is currently playing. It can be set to start or pause playback.
- 읽기 전용복제되지 않음병렬 읽기
Gets the original source resolution of the VideoFrame.Video file.
- 읽기 전용복제되지 않음병렬 읽기
Indicates the length of the VideoFrame.Video in seconds.
- 복제되지 않음병렬 읽기
Indicates the progress in seconds of the VideoFrame.Video.
The content ID of the video file a VideoFrame object is associated with.
Indicates how loud the VideoFrame.Video is currently playing back.
Determines whether a UI element sinks input.
- 병렬 읽기
Determines the origin point of a GuiObject, relative to its absolute size.
Determines whether resizing occurs based on child content.
- 병렬 읽기
Determines the GuiObject background color.
Determines the transparency of the GuiObject background and border.
- 병렬 읽기
Determines the color of the GuiObject border.
Determines in what manner the GuiObject border is laid out relative to its dimensions.
- 병렬 읽기
Determines the pixel width of a GuiObject border.
- 병렬 읽기
Determines if descendant GUIs outside of the bounds of a parent GUI element should render.
- 읽기 전용복제되지 않음병렬 읽기
- 병렬 읽기
- 병렬 읽기
Controls the sort order of a GUI when used with a UIGridStyleLayout.
Sets the GuiObject which will be selected when the Gamepad selector is moved in this direction.
Sets the GuiObject which will be selected when the Gamepad selector is moved in this direction.
Sets the GUI which will be selected when the Enum.Gamepad selector is moved in this direction.
- 병렬 읽기
Sets the GuiObject which will be selected when the Gamepad selector is moved in this direction.
Determines the pixel and scalar position of the GuiObject.
Determines the number of degrees by which a UI element is rotated.
- 병렬 읽기
Determine whether the GUI can be selected by a gamepad.
Overrides the default selection adornment used for gamepads.
- 병렬 읽기
The order of GuiObjects selected by the gamepad UI selection.
Determine the pixel and scalar size of a GUI.
Selects the GuiObject.Size axes that a GUI will be based relative to the size of its parent.
- 숨김복제되지 않음병렬 읽기더 이상 사용되지 않음
A mixed property of BackgroundTransparency and TextTransparency.
Determines whether a GuiObject.GUI and its descendants will be rendered.
Determines the order in which a GUI renders relative to other GUIs.
- 읽기 전용복제되지 않음
Describes the actual screen position of a UI element, in pixels.
- 읽기 전용복제되지 않음
Describes the actual screen rotation of a UI element, in degrees.
- 읽기 전용복제되지 않음
Describes the actual screen size of a UI element, in pixels.
- 병렬 읽기
When set to true, localization will be applied to this GuiBase2d and its descendants based on the GuiBase2d.RootLocalizationTable specified for this GuiBase2d.
A reference to a LocalizationTable to be used to apply automated localization to this GuiBase2d and its descendants.
Customizes gamepad selection behavior in the down direction.
Customizes gamepad selection behavior in the left direction.
Customizes gamepad selection behavior in the right direction.
Customizes gamepad selection behavior in the up direction.
- 병렬 읽기
Allows customization of gamepad selection movement.
메서드
Sets VideoFrame.Playing to false, pausing playback if the VideoFrame.Video is playing.
Sets VideoFrame.Playing to true, playing the VideoFrame.Video from the current VideoFrame.TimePosition.
- TweenPosition(endPosition : UDim2,easingDirection : Enum.EasingDirection,easingStyle : Enum.EasingStyle,time : number,override : bool,callback : function):bool
Smoothly moves a GUI to a new UDim2.
- TweenSize(endSize : UDim2,easingDirection : Enum.EasingDirection,easingStyle : Enum.EasingStyle,time : number,override : bool,callback : function):bool
Smoothly resizes a GUI to a new UDim2.
- TweenSizeAndPosition(endSize : UDim2,endPosition : UDim2,easingDirection : Enum.EasingDirection,easingStyle : Enum.EasingStyle,time : number,override : bool,callback : function):bool
Smoothly moves a GUI to a new size and position.
이벤트
Fires whenever the VideoFrame.Video loops.
Fires when the VideoFrame.Video has completed playback and stopped.
Fires when the VideoFrame.Video is loaded.
This event fires whenever the VideoFrame.Video is paused using VideoFrame:Pause() or by setting VideoFrame.Playing to false.
Fires whenever the VideoFrame.Video is played using the VideoFrame:Play() function or by setting VideoFrame.Playing to true.
Fired when a user begins interacting via a Human-Computer Interface device (Mouse button down, touch begin, keyboard button down, etc).
Fired when a user changes how they're interacting via a Human-Computer Interface device (Mouse button down, touch begin, keyboard button down, etc).
Fired when a user stops interacting via a Human-Computer Interface device (Mouse button down, touch begin, keyboard button down, etc).
Fires when a user moves their mouse into a GUI element.
Fires when a user moves their mouse out of a GUI element.
Fires whenever a user moves their mouse while it is inside a GUI element.
Fires when a user scrolls their mouse wheel back when the mouse is over a GUI element.
Fires when a user scrolls their mouse wheel forward when the mouse is over a GUI element.
Fired when the GuiObject is being focused on with the Gamepad selector.
Fired when the Gamepad selector stops focusing on the GuiObject.
Fires when the player starts, continues and stops long-pressing the UI element.
- TouchPan(touchPositions : Array,totalTranslation : Vector2,velocity : Vector2,state : Enum.UserInputState):RBXScriptSignal
Fires when the player moves their finger on the UI element.
- TouchPinch(touchPositions : Array,scale : number,velocity : number,state : Enum.UserInputState):RBXScriptSignal
Fires when the player performs a pinch or pull gesture using two fingers on the UI element.
- TouchRotate(touchPositions : Array,rotation : number,velocity : number,state : Enum.UserInputState):RBXScriptSignal
Fires when the player performs a rotation gesture using two fingers on the UI element.
Fires when the player performs a swipe gesture on the UI element.
Fires when the player performs a tap gesture on the UI element.
- SelectionChanged(amISelected : bool,previousSelection : GuiObject,newSelection : GuiObject):RBXScriptSignal
Fires when the gamepad selection moves to, leaves, or changes within the connected GuiBase2d or any descendent GuiObjects.
속성
IsLoaded
This property will be true when the VideoFrame.Video has loaded from Roblox servers and is ready to play.
Looped
This property sets whether or not the VideoFrame.Video repeats once it has finished when it is playing.
Playing
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
This property gets the original source resolution of the VideoFrame.Video file.
TimeLength
This property indicates the length of the VideoFrame.Video in seconds. If the video is not loaded, this value will be 0.
TimePosition
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
The content ID of the video file a VideoFrame object is associated with.
코드 샘플
local screenPart = Instance.new("Part")
screenPart.Parent = workspace
local surfaceGui = Instance.new("SurfaceGui")
surfaceGui.Parent = screenPart
local videoFrame = Instance.new("VideoFrame")
videoFrame.Parent = surfaceGui
videoFrame.Looped = true
videoFrame.Video = "rbxassetid://" -- add an asset ID to this
while not videoFrame.IsLoaded do
task.wait()
end
videoFrame:Play()
Volume
This property determines how loud the VideoFrame.Video plays back. It can be set to a number between 0 and 100.
메서드
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.
반환
Play
Sets VideoFrame.Playing to true, This plays the VideoFrame.Video, continuing from the current VideoFrame.TimePosition.
반환
코드 샘플
local screenPart = Instance.new("Part")
screenPart.Parent = workspace
local surfaceGui = Instance.new("SurfaceGui")
surfaceGui.Parent = screenPart
local videoFrame = Instance.new("VideoFrame")
videoFrame.Parent = surfaceGui
videoFrame.Looped = true
videoFrame.Video = "rbxassetid://" -- add an asset ID to this
while not videoFrame.IsLoaded do
task.wait()
end
videoFrame:Play()
이벤트
DidLoop
An event that fires whenever the VideoFrame.Video loops. Returns the content ID of the video.
매개 변수
The content ID of the video that looped.
Ended
This event fires when the VideoFrame.Video has completed playback and stopped.
매개 변수
The content ID of the paused that ended.
Paused
This event fires whenever the VideoFrame.Video is paused using VideoFrame:Pause() or by setting VideoFrame.Playing to false.
매개 변수
The content ID of the paused video.
Played
This event fires whenever the VideoFrame.Video is played using the VideoFrame:Play() function or by setting VideoFrame.Playing to true.
매개 변수
The content ID of the played video.