VideoPlayer
ไม่สามารถเรียกดู

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่


ข้อมูลสรุป

สมาชิกที่ได้รับทอด
ตัวอย่างโค้ด
ผู้เล่นวิดีโอ (เซิร์ฟเวอร์)
-- สิ่งนี้ควรอยู่ใน "Script" ที่ตั้งค่า RunContext เป็น "Legacy" หรือ "Server"
-- สร้างสิ่งที่วิดีโอแสดงอยู่
local videoScreenPart = Instance.new("Part")
videoScreenPart.Anchored = true
videoScreenPart.Size = Vector3.new(12, 6, 1)
videoScreenPart.CFrame = CFrame.new(0, 5, 0)
videoScreenPart.Parent = workspace
local videoScreenUI = Instance.new("SurfaceGui")
videoScreenUI.Parent = videoScreenPart
local videoDisplay = Instance.new("VideoDisplay")
videoDisplay.Size = UDim2.fromScale(1, 1)
videoDisplay.Parent = videoScreenUI
-- สร้างที่มาของวิดีโอ
local videoSource = Instance.new("VideoPlayer")
videoSource.VideoContent = Content.fromUri("rbxassetid://5608359401")
videoSource.Looping = true
videoSource.Parent = videoScreenPart
-- สร้างที่มาของเสียงวิดีโอ
local speakerPart = Instance.new("Part")
speakerPart.Anchored = true
speakerPart.Parent = workspace
local audioEmitter = Instance.new("AudioEmitter")
audioEmitter.Parent = speakerPart
-- สร้างและเชื่อมต่อสายเพื่อให้วิดีโอเรนเดอร์ได้อย่างมองเห็นและปล่อยเสียง
local videoWire = Instance.new("Wire")
videoWire.SourceInstance = videoSource
videoWire.TargetInstance = videoDisplay
videoWire.Parent = videoSource
local audioWire = Instance.new("Wire")
audioWire.SourceInstance = videoSource
audioWire.TargetInstance = audioEmitter
audioWire.Parent = videoSource
-- เล่นวิดีโอ
-- หมายเหตุ: การเล่นวิดีโอบนเซิร์ฟเวอร์ไม่รับประกันว่าจะโหลดหรือซิงค์สำหรับลูกค้าทุกคน การเล่นบนลูกค้าจะดีกว่า
videoSource:Play()
เครื่องเล่นวิดีโอ (ฝั่งไคลเอนต์)
local videoSource = Instance.new("VideoPlayer")
videoSource.VideoContent = Content.fromUri("rbxassetid://5608359401")
videoSource.Parent = script.Parent
-- เล่นวิดีโอหลังจากที่มันโหลดเสร็จ
videoSource:GetPropertyChangedSignal("IsLoaded"):Connect(function()
if videoSource.IsLoaded then
print("วิดีโอโหลดเสร็จแล้ว กำลังเริ่มเล่นใน 2 วินาที.")
task.wait(2)
videoSource:Play()
end
end)
-- โหลดวิดีโอเพื่อให้พร้อมเมื่อเราต้องการ
videoSource:LoadAsync()
task.wait(5)
-- ยกเลิกการโหลดวิดีโอเพื่อลดการใช้ทรัพยากร
videoSource:Unload()

เอกสารอ้างอิงเกี่ยวกับ API
คุณสมบัติ
AutoLoadInStudio
ไม่ซ้ำ
ไม่สามารถเขียนสคริปต์
การรักษาความปลอดภัยของสคริปต์ Roblox
อ่านพร้อมๆ กัน
ความสามารถ: Audio, UI
VideoPlayer.AutoLoadInStudio:boolean

AutoPlayInStudio
ไม่ซ้ำ
ไม่สามารถเขียนสคริปต์
การรักษาความปลอดภัยของสคริปต์ Roblox
อ่านพร้อมๆ กัน
ความสามารถ: Audio, UI
VideoPlayer.AutoPlayInStudio:boolean

IsLoaded
อ่านอย่างเดียว
ไม่ซ้ำ
อ่านพร้อมๆ กัน
ความสามารถ: Audio, UI
VideoPlayer.IsLoaded:boolean

IsPlaying
อ่านอย่างเดียว
ไม่ซ้ำ
อ่านพร้อมๆ กัน
ความสามารถ: Audio, UI
VideoPlayer.IsPlaying:boolean

Looping
อ่านพร้อมๆ กัน
ความสามารถ: Audio, UI
VideoPlayer.Looping:boolean

MaximumResolution
ซ่อนอยู่
อ่านพร้อมๆ กัน
ความสามารถ: Audio, UI, InternalTest
VideoPlayer.MaximumResolution:Enum.VideoSampleSize

PlaybackSpeed
อ่านพร้อมๆ กัน
ความสามารถ: Audio, UI
VideoPlayer.PlaybackSpeed:number

Resolution
อ่านอย่างเดียว
ไม่ซ้ำ
อ่านพร้อมๆ กัน
ความสามารถ: Audio, UI
VideoPlayer.Resolution:Vector2

TimeLength
อ่านอย่างเดียว
ไม่ซ้ำ
อ่านพร้อมๆ กัน
ความสามารถ: Audio, UI
VideoPlayer.TimeLength:number

TimePosition
อ่านพร้อมๆ กัน
ความสามารถ: Audio, UI
VideoPlayer.TimePosition:number

VideoContent
อ่านพร้อมๆ กัน
ความสามารถ: Audio, UI
VideoPlayer.VideoContent:Content

Volume
อ่านพร้อมๆ กัน
ความสามารถ: Audio, UI
VideoPlayer.Volume:number

วิธีการ
GetConnectedWires
ความสามารถ: Audio, UI
VideoPlayer:GetConnectedWires(pin:string):{Wire}
พารามิเตอร์
pin:string
ส่งค่ากลับ

GetInputPins
ความสามารถ: Audio, UI
VideoPlayer:GetInputPins():{string}
ส่งค่ากลับ

GetOutputPins
ความสามารถ: Audio, UI
VideoPlayer:GetOutputPins():{string}
ส่งค่ากลับ

LoadAsync
ผลตอบแทน
ความสามารถ: Audio, UI
VideoPlayer:LoadAsync():Enum.AssetFetchStatus
ส่งค่ากลับ

Pause
ความสามารถ: Audio, UI
VideoPlayer:Pause():()
ส่งค่ากลับ
()

Play
ความสามารถ: Audio, UI
VideoPlayer:Play():()
ส่งค่ากลับ
()

Unload
ความสามารถ: Audio, UI
VideoPlayer:Unload():()
ส่งค่ากลับ
()

เหตุการณ์
DidEnd
ความสามารถ: Audio, UI
VideoPlayer.DidEnd():RBXScriptSignal

DidLoop
ความสามารถ: Audio, UI
VideoPlayer.DidLoop():RBXScriptSignal

PlayFailed
ความสามารถ: Audio, UI
VideoPlayer.PlayFailed(error:Enum.AssetFetchStatus):RBXScriptSignal
พารามิเตอร์

WiringChanged
ความสามารถ: Audio, UI
VideoPlayer.WiringChanged(
connected:boolean, pin:string, wire:Wire, instance:Instance
พารามิเตอร์
connected:boolean
pin:string
wire:Wire
instance:Instance

©2026 Roblox Corporation. Roblox, โลโก้ Roblox และ Powering Imagination เป็นส่วนหนึ่งของเครื่องหมายการค้าที่จดทะเบียน และไม่ได้จดทะเบียนของเราในสหรัฐฯ และประเทศอื่นๆ