// %BANNER_BEGIN% // --------------------------------------------------------------------- // %COPYRIGHT_BEGIN% // Copyright (c) (2018-2022) Magic Leap, Inc. All Rights Reserved. // Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2 // Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein. // %COPYRIGHT_END% // --------------------------------------------------------------------- // %BANNER_END% namespace UnityEngine.XR.MagicLeap { using UnityEngine.XR.MagicLeap.Native; /// /// MLWebRTC class contains the API to interface with the /// WebRTC C API. /// public partial class MLWebRTC { /// /// Class that represents a audio sink used by the MLWebRTC API. /// public abstract class Sink { /// /// Initializes a new instance of the class. /// protected Sink() { } /// /// Initializes a new instance of the class. /// /// The handle of the sink. protected Sink(ulong handle) { this.Handle = handle; } /// /// Gets or sets the reference to the stream. /// public MLWebRTC.MediaStream Stream { get; protected set; } /// /// Gets the type of the sink. /// public MediaStream.Track.Type Type { get; internal set; } /// /// Gets the handle of the sink. /// internal ulong Handle { get; set; } /// /// Abstract method for destroying the sink. /// /// /// MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. /// MLResult.Result will be MLResult.Code.WebRTCResultInstanceNotCreated if MLWebRTC instance was not created. /// MLResult.Result will be MLResult.Code.WebRTCResultMismatchingHandle if an incorrect handle was sent. /// public abstract MLResult Destroy(); /// /// Abstract method for setting the sink's track. /// /// The track to set the sink to. /// /// MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. /// MLResult.Result will be MLResult.Code.WebRTCResultInstanceNotCreated if MLWebRTC instance was not created. /// MLResult.Result will be MLResult.Code.WebRTCResultMismatchingHandle if an incorrect handle was sent. /// protected abstract MLResult SetTrack(MLWebRTC.MediaStream.Track track); /// /// Used to invalidate handle by inherited classes. /// protected void InvalidateHandle() { this.Handle = MagicLeapNativeBindings.InvalidHandle; } } } }