VideoFrame

Hiển Thị Bản Đã Lỗi Thời

*Nội dung này sẽ sớm có sẵn bằng ngôn ngữ bạn chọn.

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.

Mẫu mã

Creating and Playing a Video

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()

Tóm Tắt

Thuộc Tính

Thuộc Tính kế thừa từ GuiObjectThuộc Tính kế thừa từ GuiBase2d

Phương Pháp

Phương Pháp kế thừa từ GuiObject

Sự Kiện

Sự Kiện kế thừa từ GuiObjectSự Kiện kế thừa từ GuiBase2d

Thuộc Tính

IsLoaded

Chỉ Đọc
Không Sao Chép
Đọc Song Song

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

Looped

Đọc Song Song

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

Playing

Không Sao Chép
Đọc Song Song

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

Chỉ Đọc
Không Sao Chép
Đọc Song Song

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

TimeLength

Chỉ Đọc
Không Sao Chép
Đọc Song Song

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

TimePosition

Không Sao Chép
Đọc Song Song

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
Đọc Song Song

The content ID of the video file a VideoFrame object is associated with.

Mẫu mã

Creating and Playing a Video

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

Đọc Song Song

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

Phương Pháp

Pause

void

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.


Lợi Nhuận

void

Play

void

Sets VideoFrame.Playing to true, This plays the VideoFrame.Video, continuing from the current VideoFrame.TimePosition.


Lợi Nhuận

void

Mẫu mã

Creating and Playing a Video

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()

Sự Kiện

DidLoop

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

Tham Số

video: string

The content ID of the video that looped.


Ended

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

Tham Số

video: string

The content ID of the paused that ended.


Loaded

This event fires when the VideoFrame.Video is loaded.

Tham Số

video: string

The content ID of the loaded video.


Paused

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

Tham Số

video: string

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.

Tham Số

video: string

The content ID of the played video.