学ぶ
エンジンクラス
VideoPlayer
閲覧できません

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。


コードサンプル
ビデオプレイヤー(サーバー側)
-- これは、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.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リファレンス
プロパティ
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():{any}
戻り値

GetOutputPins
機能: Audio, UI
VideoPlayer:GetOutputPins():{any}
戻り値

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は、米国並びにその他の国における登録商標および非登録商標です。