Example #1
0
        /// <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);
        }
Example #2
0
        /// <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);
        }
Example #3
0
        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);
        }
Example #4
0
 /// <summary>
 /// Stops renderering the local video stream.
 /// </summary>
 public void DisableLocalVideo()
 {
     NativeVideoInterop.DisableLocalVideo(_nativeVideoHandle);
 }
Example #5
0
 /// <summary>
 /// Creates a NativeRenderer for the provided PeerConnection.
 /// </summary>
 /// <param name="peerConnection"></param>
 public NativeVideo(IntPtr videoHandle)
 {
     _nativeVideoHandle             = NativeVideoInterop.Create(videoHandle);
     _lookupDictionary[videoHandle] = this;
 }
Example #6
0
 /// <summary>
 /// Disposes the underlying NativeRenderer.
 /// </summary>
 public void Dispose()
 {
     NativeVideoInterop.Destroy(_nativeVideoHandle);
     _nativeVideoHandle = IntPtr.Zero;
 }
Example #7
0
 /// <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);
 }
Example #8
0
 /// <summary>
 /// Sets callback for texture size changes mid stream.
 /// </summary>
 public static void SetTextureChangeCallback()
 {
     NativeVideoInterop.SetTextureSizeChanged(TextureSizeChangeCallback);
 }
Example #9
0
 /// <summary>
 /// Returns the native rendering update method to be called by Unity.
 /// </summary>
 public static IntPtr GetVideoUpdateMethod()
 {
     return(NativeVideoInterop.GetVideoUpdateMethod());
 }
Example #10
0
 /// <summary>
 /// Stops rendering the remote video stream.
 /// </summary>
 public void DisableRemoteVideo()
 {
     NativeVideoInterop.DisableRemoteVideo(_nativeVideoHandle);
     _lookupDictionary.Remove(_nativeVideoHandle);
 }
Example #11
0
 /// <summary>
 /// Stops rendering the remote video stream.
 /// </summary>
 public void DisableRemoteVideo()
 {
     NativeVideoInterop.DisableRemoteVideo(_nativeVideoHandle);
 }
Example #12
0
 /// <summary>
 /// Creates a NativeRenderer for the provided PeerConnection.
 /// </summary>
 /// <param name="peerConnection"></param>
 public NativeVideo(IntPtr videoHandle)
 {
     _nativeVideoHandle = NativeVideoInterop.Create(videoHandle);
 }