視頻框渲染一個長方形,與 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.
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()
概要
屬性
指示當 VideoFrame.Video 從 Roblox 伺服器載入並準備好玩 遊玩時。
設置是否在播放時重複 VideoFrame.Video 一次,當它完成時。
指示是否播放 VideoFrame.Video 。它可以設為開始或暫停播放。
取得 VideoFrame.Video 文件的原始解析度。
指示 VideoFrame.Video 的長度以秒為單位。
指示 VideoFrame.Video 的秒鐘進度。
與 VideoFrame 對象相關的視頻文件的內容ID。
指示 VideoFrame.Video 目前播返回的音量。
決定這個介面元素是否會沉沒輸入。
決定 GuiObject 的起始點,相對於其絕對尺寸。
決定是否基於兒童內容進行縮放。
決定 GuiObject 背景顏色。
決定 GuiObject 背景和邊框的透明度。
決定 GuiObject 邊框的顏色。
決定在哪種方式下 GuiObject 邊界被布置在其尺寸相對。
決定 GuiObject 邊框的像素寬度。
決定是否在父 GUI 元素的範圍之外成像子元素 GuiObjects 。
決定玩家的鼠標是否在 GuiObject 上被主動按下。
控制使用 GuiObject 與 UIGridStyleLayout 時的排序順序。
設置在遊戲控制器選擇器向下移動時會選擇的 GuiObject 。
設置在遊戲控制器選擇器移動到左側時會選擇的 GuiObject 。
設置在遊戲控制器選擇器移動到右側時會選擇的 GuiObject 。
設置在遊戲控制器選擇器向上移動時會選擇的 GuiObject 。
決定 GuiObject 的像素和向量位置。
決定旋轉 GuiObject 的角度數量。
確定是否可以由遊戲控制器選擇 GuiObject 。
覆蓋使用於遊戲板的預設選擇裝飾。
由遊戲控制器介面選擇所選擇的 GuiObjects 順序。
決定 GuiObject 的像素和積分尺寸。
混合屬性 BackgroundTransparency 和 TextTransparency 。
決定是否渲染 GuiObject 和其子孫。
決定 GuiObject 對其他人的相對順序進行渲染。
方法
將 VideoFrame.Playing 設為 false,在 VideoFrame.Video 播放時暫停播放。
將 VideoFrame.Playing 設為真值,播放現有 VideoFrame.Video 的 VideoFrame.TimePosition。
- TweenPosition(endPosition : UDim2,easingDirection : Enum.EasingDirection,easingStyle : Enum.EasingStyle,time : number,override : boolean,callback : function):boolean
順暢將 GUI 移動到新的 UDim2 。
- TweenSize(endSize : UDim2,easingDirection : Enum.EasingDirection,easingStyle : Enum.EasingStyle,time : number,override : boolean,callback : function):boolean
- TweenSizeAndPosition(endSize : UDim2,endPosition : UDim2,easingDirection : Enum.EasingDirection,easingStyle : Enum.EasingStyle,time : number,override : boolean,callback : function):boolean
順暢將 GUI 移動到新的尺寸和位置。
活動
每當循環 VideoFrame.Video 時發生火災。
當 VideoFrame.Video 完成播放並停止時,發生火災
當 VideoFrame.Video 載入時發生火災。
這個事件會在 VideoFrame.Video 使用 VideoFrame:Pause() 暫停或設置 VideoFrame.Playing 為 false 時發生。
每當 VideoFrame.Video 使用 VideoFrame:Play() 函數播放或設置 VideoFrame.Playing 為真實時,都會發生火災。
當使用者開始使用人工智慧與電腦介面裝置(例如滑鼠按鈕向下、觸摸開始、鍵盤按鈕向下等)時發射。
當使用者變更如何透過人工智慧與電腦介面裝置(滑鼠按鈕向下、觸摸開始、鍵盤按鈕向下等)進行互動時,發射時間。
當使用者停止使用人工智慧與電腦介面裝置(例如:滑鼠按鈕向下、觸摸開始、鍵盤按鈕向下等)互動時,發射。
當使用者將鼠標移到 GUI 元素時發生火災。
當使用者將鼠標移出 GUI 元素時發生火災。
在使用者移動滑鼠時,無論在哪個GUI元素內,都會發生火災。
當使用者滾動滑鼠輪時,滑鼠停在 GUI 元素上時,發生火災。
當使用者將滑鼠輪向前滾動時,發生火災,當滑鼠在 GUI 元素上時。
當使用遊戲控制器選擇器將 GuiObject 聚焦時,發射。
當遊戲控制器選擇器停止關注 GuiObject 時發射。
當玩家開始、繼續並停止長按 UI 元素時,發生火災。
- TouchPan(touchPositions : Array,totalTranslation : Vector2,velocity : Vector2,state : Enum.UserInputState):RBXScriptSignal
當玩家在介面元素上移動手指時發生火災。
- TouchPinch(touchPositions : Array,scale : number,velocity : number,state : Enum.UserInputState):RBXScriptSignal
當玩家使用介面元素上的兩個手指執行撥動或拉動動作時,發生火焰。
- TouchRotate(touchPositions : Array,rotation : number,velocity : number,state : Enum.UserInputState):RBXScriptSignal
當玩家使用介面元素上的兩個手指執行旋轉動作時,發生火災。
當玩家在介面元素上執行滑動動作時,發生火災。
當玩家在介面元素上執行點擊動作時,發生火焰。
- SelectionChanged(amISelected : boolean,previousSelection : GuiObject,newSelection : GuiObject):RBXScriptSignal
當遊戲控制器選擇移動到、離開或變更連接的 GuiBase2d 或任何子控制器 GuiObjects 時發生火災。
屬性
Playing
此屬性表示 VideoFrame.Video 目前是否正在播放。它可以設為開始或暫停播放,作為 VideoFrame:Play() 和 VideoFrame:Pause() 功能的替代。
Video
與 VideoFrame 對象相關的視頻文件的內容ID。
範例程式碼
The code sample below demonstrates how to create and play a VideoFrame with SomeValidAssetID once the video has loaded.
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()
方法
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.
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()
活動
Paused
這個事件會在 VideoFrame.Video 使用 VideoFrame:Pause() 暫停或設置 VideoFrame.Playing 為 false 時發生。
參數
暫停的視頻的內容ID。