docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class AudioStreamSender

    Component for sending audio streams.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    StreamSenderBase
    AudioStreamSender
    Implements
    IStreamSender
    Inherited Members
    StreamSenderBase.Transceivers
    StreamSenderBase.OnStartedStream
    StreamSenderBase.OnStoppedStream
    StreamSenderBase.Track
    StreamSenderBase.isPlaying
    StreamSenderBase.SetTransceiver(string, RTCRtpTransceiver)
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    MonoBehaviour.CancelInvoke(string)
    MonoBehaviour.IsInvoking(string)
    MonoBehaviour.StartCoroutine(string)
    MonoBehaviour.StartCoroutine(string, object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(string)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, bool)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>(bool)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(string)
    Component.SendMessageUpwards(string, object, SendMessageOptions)
    Component.SendMessageUpwards(string, object)
    Component.SendMessageUpwards(string)
    Component.SendMessageUpwards(string, SendMessageOptions)
    Component.SendMessage(string, object)
    Component.SendMessage(string)
    Component.SendMessage(string, object, SendMessageOptions)
    Component.SendMessage(string, SendMessageOptions)
    Component.BroadcastMessage(string, object, SendMessageOptions)
    Component.BroadcastMessage(string, object)
    Component.BroadcastMessage(string)
    Component.BroadcastMessage(string, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: Unity.RenderStreaming
    Assembly: Unity.RenderStreaming.dll
    Syntax
    [AddComponentMenu("Render Streaming/Audio Stream Sender")]
    public class AudioStreamSender : StreamSenderBase, IStreamSender

    Properties

    audioListener

    Gets or sets the AudioListener component used as the audio source.

    Declaration
    public AudioListener audioListener { get; set; }
    Property Value
    Type Description
    AudioListener
    See Also
    AudioStreamSource
    AudioCodecInfo

    audioSource

    Gets or sets the AudioSource component used as the audio source.

    Declaration
    public AudioSource audioSource { get; set; }
    Property Value
    Type Description
    AudioSource
    See Also
    AudioStreamSource
    AudioCodecInfo

    codec

    Gets the codec used for the audio stream.

    Declaration
    public AudioCodecInfo codec { get; }
    Property Value
    Type Description
    AudioCodecInfo
    See Also
    AudioStreamSource
    AudioCodecInfo

    loopback

    Gets or sets whether to play the audio locally while sending it to the remote peer.

    Declaration
    public bool loopback { get; set; }
    Property Value
    Type Description
    bool
    See Also
    AudioStreamSource
    AudioCodecInfo

    maxBitrate

    Gets the maximum bitrate for the audio stream.

    Declaration
    public uint maxBitrate { get; }
    Property Value
    Type Description
    uint
    See Also
    AudioStreamSource
    AudioCodecInfo

    minBitrate

    Gets the minimum bitrate for the audio stream.

    Declaration
    public uint minBitrate { get; }
    Property Value
    Type Description
    uint
    See Also
    AudioStreamSource
    AudioCodecInfo

    source

    Gets or sets the source of the audio stream.

    Declaration
    public AudioStreamSource source { get; set; }
    Property Value
    Type Description
    AudioStreamSource
    See Also
    AudioStreamSource
    AudioCodecInfo

    sourceDeviceIndex

    Gets or sets the index of the microphone device used as the audio source.

    Declaration
    public int sourceDeviceIndex { get; set; }
    Property Value
    Type Description
    int
    See Also
    AudioStreamSource
    AudioCodecInfo

    Methods

    GetAvailableCodecs()

    Declaration
    public static IEnumerable<AudioCodecInfo> GetAvailableCodecs()
    Returns
    Type Description
    IEnumerable<AudioCodecInfo>
    See Also
    AudioStreamSource
    AudioCodecInfo

    SetBitrate(uint, uint)

    Sets the bitrate range for the audio stream.

    Declaration
    public void SetBitrate(uint minBitrate, uint maxBitrate)
    Parameters
    Type Name Description
    uint minBitrate

    The minimum bitrate in kbps. Must be greater than zero.

    uint maxBitrate

    The maximum bitrate in kbps. Must be greater than or equal to the minimum bitrate.

    Examples
    audioStreamSender.SetBitrate(128, 256);
    Exceptions
    Type Condition
    ArgumentException

    Thrown when the maximum bitrate is less than the minimum bitrate.

    See Also
    AudioStreamSource
    AudioCodecInfo

    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 = AudioStreamSender.GetAvailableCodecs().First(x => x.mimeType.Contains("opus"));
    audioStreamSender.SetCodec(codec);
    See Also
    AudioStreamSource
    AudioCodecInfo

    SetData(ReadOnly, int)

    Sets the audio data for the stream.

    Declaration
    public void SetData(NativeArray<float>.ReadOnly nativeArray, int channels)
    Parameters
    Type Name Description
    NativeArray<float>.ReadOnly nativeArray

    The native array containing the audio data.

    int channels

    The number of audio channels.

    Examples
    int sampleRate = AudioSettings.outputSampleRate;
    int frequency = 440;
    int bufferSize = sampleRate; // 1 second buffer
    var audioData = new NativeArray<float>(bufferSize, Allocator.Temp);
    for (int i = 0; i < bufferSize; i++)
    {
        audioData[i] = Mathf.Sin(2 * Mathf.PI * frequency * i / sampleRate);
    }
    audioStreamSender.SetData(audioData.AsReadOnly(), 1);
    audioData.Dispose();
    Exceptions
    Type Condition
    InvalidOperationException

    Thrown when the source property is not set to AudioStreamSource.APIOnly.

    See Also
    AudioStreamSource
    AudioCodecInfo

    Implements

    IStreamSender

    See Also

    AudioStreamSource
    AudioCodecInfo
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)