요약
속성
이벤트
WiringChanged(connected: boolean,pin: string,wire: Wire,instance: Instance):RBXScriptSignal |
상속된 멤버
코드 샘플
비디오 플레이어 (서버 측)
-- 이 스크립트는 "Legacy" 또는 "Server"로 설정된 RunContext에서 실행되어야 합니다.
-- 비디오가 표시되는 부분을 생성합니다.
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.new(1, 0, 1, 0)
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()비디오 플레이어 (클라이언트 측)
-- 이 코드는 "LocalScript" 또는 "Script"에서 RunContext가 "Client"로 설정되어 있어야 합니다.
-- "비디오 재생" 섹션까지 위 샘플과 동일한 코드입니다.
-- 비디오가 로드된 후 재생합니다.
videoSource:GetPropertyChangedSignal("IsLoaded"):Connect(function()
if videoSource.IsLoaded then
print("비디오가 로드되었습니다. 2초 후 재생을 시작합니다.")
wait(2)
videoSource:Play()
end
end)
-- 필요할 때 준비할 수 있도록 비디오를 로드합니다.
videoSource:LoadAsync()
wait(5)
-- 자원 절약을 위해 비디오를 언로드합니다.
videoSource:Unload()API 참조
속성
메서드
Pause
VideoPlayer:Pause():()
반환
()
Play
VideoPlayer:Play():()
반환
()
Unload
VideoPlayer:Unload():()
반환
()
이벤트
PlayFailed