Class AudioStreamReceiver
AudioStreamReceiver is a component that receives audio streams and plays them through a specified AudioSource.
Implements
Inherited Members
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Namespace: Unity.RenderStreaming
Assembly: Unity.RenderStreaming.dll
Syntax
[AddComponentMenu("Render Streaming/Audio Stream Receiver")]
public class AudioStreamReceiver : StreamReceiverBase, IStreamReceiver
Fields
OnUpdateReceiveAudioSource
Event triggered when the received audio source is updated.
Declaration
public AudioStreamReceiver.OnUpdateReceiveAudioSourceHandler OnUpdateReceiveAudioSource
Field Value
Type | Description |
---|---|
AudioStreamReceiver.OnUpdateReceiveAudioSourceHandler |
See Also
Properties
codec
Gets the codec information for the audio stream.
Declaration
public AudioCodecInfo codec { get; }
Property Value
Type | Description |
---|---|
AudioCodecInfo |
See Also
targetAudioSource
Gets or sets the target AudioSource where the received audio will be played.
Declaration
public AudioSource targetAudioSource { get; set; }
Property Value
Type | Description |
---|---|
AudioSource |
See Also
Methods
GetAvailableCodecs()
Declaration
public static IEnumerable<AudioCodecInfo> GetAvailableCodecs()
Returns
Type | Description |
---|---|
IEnumerable<AudioCodecInfo> |
See Also
SetCodec(AudioCodecInfo)
Sets the codec for the audio stream.
Declaration
public void SetCodec(AudioCodecInfo codec)
Parameters
Type | Name | Description |
---|---|---|
AudioCodecInfo | codec | The codec information to set. |
Examples
var codec = AudioStreamReceiver.GetAvailableCodecs().FirstOrDefault(x => x.mimeType.Contains("opus"));
audioStreamReceiver.SetCodec(codec);
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if the transceiver is streaming or the track has ended. |