Skip to content

Api > VideoPlayer > SetTargetAudioSource()


VideoPlayer.SetTargetAudioSource(number trackIndex, AudioSource source)⚓︎

Sets the AudioSource that will receive audio samples for the specified track if this audio target is selected with VideoPlayer.audioOutputMode.

Parameters:⚓︎

Name Type Description
trackIndex number Index of the audio track to associate with the specified AudioSource.
source AudioSource AudioSource to associate with the audio track.

Usage⚓︎

---@type VideoPlayer
local videoplayer;

---@type number
local trackIndex;

---@type AudioSource
local source;


videoplayer.SetTargetAudioSource(trackIndex, source)