VideoFrame

顯示已棄用項目

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

視頻框渲染一個長方形,與 Frame 一樣,使用移動的視頻圖像。視頻必須來自上傳到 Roblox 網站的文件。

視頻會縮放以適應長方形的整體,但在原始解析度下顯示最佳。

2D 和 3D 音效

在 下方放置的視頻框會從該部分的 發出聲音。

視頻框會展示杜比效果,即其頻率和傾斜會隨著附帶的任何部分相對運動而變化。

視頻框的音量將由客戶端的音訊聆聽器(默認為 Camera 位置)和視頻框的部分位置決定。

視頻框被視為 "全球" 如果它不放置在基礎零件上的SurfaceGui下面。在這種情況下,聲音將在整個空間方播放相同的音量。

範例程式碼

The code sample below demonstrates how to create and play a VideoFrame with SomeValidAssetID once the video has loaded.

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

概要

屬性

屬性 繼承自 GuiObject屬性 繼承自 GuiBase2d

方法

方法 繼承自 GuiObject

活動

活動 繼承自 GuiObject活動 繼承自 GuiBase2d

屬性

IsLoaded

唯讀
未複製
平行讀取

VideoFrame.Video 從 Roblox 伺服器載入並準備好播玩 遊玩時,此屬性將為真值。

Looped

平行讀取

此屬性設置是否重複 VideoFrame.Video 一旦播放完畢時會否重複。

Playing

未複製
平行讀取

此屬性表示 VideoFrame.Video 目前是否正在播放。它可以設為開始或暫停播放,作為 VideoFrame:Play()VideoFrame:Pause() 功能的替代。

Resolution

唯讀
未複製
平行讀取

此屬性獲得 VideoFrame.Video 文件的原始解析度。

TimeLength

唯讀
未複製
平行讀取

此屬性指示 VideoFrame.Video 的長度以秒為單位。如果視頻未載入,此值將為 0。

TimePosition

未複製
平行讀取

此屬性指示 VideoFrame.Video 的秒進度。它可以被更改,以在播放期間將視頻的播放位置前後移動。

Video

ContentId
平行讀取

VideoFrame 對象相關的視頻文件的內容ID。

範例程式碼

The code sample below demonstrates how to create and play a VideoFrame with SomeValidAssetID once the video has loaded.

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

平行讀取

這個屬性決定了 VideoFrame.Video 播返回的音量。它可以設為 0 到 100 之間的數字。

方法

Pause

()

VideoFrame.Playing 設為 false,在 VideoFrame.Video 播放時暫停播放。

因為 VideoFrame.TimePosition 未被重置,當視頻被恢復時,它將從以前的位置繼續。


返回

()

Play

()

VideoFrame.Playing 設為真值,這會播放 VideoFrame.Video,從現有的 VideoFrame.TimePosition 繼續。


返回

()

範例程式碼

The code sample below demonstrates how to create and play a VideoFrame with SomeValidAssetID once the video has loaded.

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

活動

DidLoop

一個事件,會在 VideoFrame.Video 循環發射時發生。返回視頻的內容ID。

參數

video: string

循環的視頻的內容ID。


Ended

VideoFrame.Video 完成播放並停止時,此事件會發生。

參數

video: string

暫停結束的內容ID。


Loaded

此事件在 VideoFrame.Video 載入時發生。

參數

video: string

載入的視頻的內容ID。


Paused

這個事件會在 VideoFrame.Video 使用 VideoFrame:Pause() 暫停或設置 VideoFrame.Playing 為 false 時發生。

參數

video: string

暫停的視頻的內容ID。


Played

這個事件會在 VideoFrame.Video 使用 VideoFrame:Play() 函數播放或設置 VideoFrame.Playing 為真實時發生。

參數

video: string

播放的視頻的內容ID。