/// <summary> /// Starts rendering the remote video stream to the provided textures. /// Only kI420 is currently supported. /// /// Calling this will override anything that is currently /// subscribed to the FrameReady call back on the VideoTrack. /// /// It is not necessary to send a textures array, if none is specified /// or a texture array of the wrong size is specified, the TextureSizeChanged /// callback will be fired and the textures can be updated with UpdateRemoteTextures. /// </summary> /// <param name="format"></param> /// <param name="textures"></param> public void EnableRemoteVideo(VideoKind format, TextureDesc[] textures) { if (textures != null) { UpdateRemoteTextures(format, textures); } NativeVideoInterop.EnableRemoteVideo(_nativeVideoHandle, format); }
/// <summary> /// Starts renderering the local video stream to the provided textures. /// Only kI420 is currently supported. /// </summary> /// <param name="format"></param> /// <param name="textures"></param> public void EnableLocalVideo(VideoKind format, TextureDesc[] textures) { var interopTextures = textures.Select(item => new NativeVideoInterop.TextureDesc { texture = item.texture, width = item.width, height = item.height }).ToArray(); NativeVideoInterop.EnableLocalVideo(_nativeVideoHandle, format, interopTextures, interopTextures.Length); }
public void UpdateRemoteTextures(VideoKind format, TextureDesc[] textures) { if (!ValidateFrameTextures(format, textures)) { return; } var interopTextures = textures.Select(item => new NativeVideoInterop.TextureDesc { texture = item.texture, width = item.width, height = item.height }).ToArray(); NativeVideoInterop.UpdateRemoteTextures(_nativeVideoHandle, format, interopTextures, interopTextures.Length); }
/// <summary> /// Stops renderering the local video stream. /// </summary> public void DisableLocalVideo() { NativeVideoInterop.DisableLocalVideo(_nativeVideoHandle); }
/// <summary> /// Creates a NativeRenderer for the provided PeerConnection. /// </summary> /// <param name="peerConnection"></param> public NativeVideo(IntPtr videoHandle) { _nativeVideoHandle = NativeVideoInterop.Create(videoHandle); _lookupDictionary[videoHandle] = this; }
/// <summary> /// Disposes the underlying NativeRenderer. /// </summary> public void Dispose() { NativeVideoInterop.Destroy(_nativeVideoHandle); _nativeVideoHandle = IntPtr.Zero; }
/// <summary> /// Sets callback handlers for the logging of debug, warning, and error messages. /// </summary> public static void SetLoggingFunctions(LogCallback logDebugCallback, LogCallback logErrorCallback, LogCallback logWarningCallback) { NativeVideoInterop.SetLoggingFunctions(logDebugCallback, logErrorCallback, logWarningCallback); }
/// <summary> /// Sets callback for texture size changes mid stream. /// </summary> public static void SetTextureChangeCallback() { NativeVideoInterop.SetTextureSizeChanged(TextureSizeChangeCallback); }
/// <summary> /// Returns the native rendering update method to be called by Unity. /// </summary> public static IntPtr GetVideoUpdateMethod() { return(NativeVideoInterop.GetVideoUpdateMethod()); }
/// <summary> /// Stops rendering the remote video stream. /// </summary> public void DisableRemoteVideo() { NativeVideoInterop.DisableRemoteVideo(_nativeVideoHandle); _lookupDictionary.Remove(_nativeVideoHandle); }
/// <summary> /// Stops rendering the remote video stream. /// </summary> public void DisableRemoteVideo() { NativeVideoInterop.DisableRemoteVideo(_nativeVideoHandle); }
/// <summary> /// Creates a NativeRenderer for the provided PeerConnection. /// </summary> /// <param name="peerConnection"></param> public NativeVideo(IntPtr videoHandle) { _nativeVideoHandle = NativeVideoInterop.Create(videoHandle); }