Esempio n. 1
0
        /// <summary>
        /// 移除 View 绑定参数
        /// </summary>
        /// <param name="engine">TRTCCloud 实例,用户注册视频数据回调。</param>
        public void RemoveEngine(ITRTCCloud engine)
        {
            if (mLocalView)
            {
                TXLiteAVVideoViewManager.GetInstance().RemoveView("", mStreamType, this);
            }
            else
            {
                TXLiteAVVideoViewManager.GetInstance().RemoveView(mUserId, mStreamType, this);
            }
            int count = TXLiteAVVideoViewManager.GetInstance().Count;

            if (engine != null)
            {
                if (count == 0)
                {
                    engine.setLocalVideoRenderCallback(TRTCVideoPixelFormat.TRTCVideoPixelFormat_Unknown,
                                                       TRTCVideoBufferType.TRTCVideoBufferType_Unknown, null);
                }
                if (!mLocalView && !TXLiteAVVideoViewManager.GetInstance().HasUserId(mUserId))
                {
                    engine.setRemoteVideoRenderCallback(mUserId, TRTCVideoPixelFormat.TRTCVideoPixelFormat_Unknown,
                                                        TRTCVideoBufferType.TRTCVideoBufferType_Unknown, null);
                }
            }
            lock (mArgbFrame)
                ReleaseBuffer(mArgbFrame);
            mUserId     = "";
            mOccupy     = false;
            mLocalView  = false;
            mFirstFrame = false;
            mRenderMode = TRTCVideoFillMode.TRTCVideoFillMode_Fit;
            this.Refresh();
        }
Esempio n. 2
0
        public CustomVideoPanel()
        {
            mIsStartCustomRender = false;  // 默认关闭自定义渲染
            mRenderMode          = TRTCVideoFillMode.TRTCVideoFillMode_Fit;
            mArgbRenderFrame     = new AVFrameBufferInfo();

            // 使用双缓冲,防止绘制过程出现闪烁
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
            SetStyle(ControlStyles.DoubleBuffer, true);         // 双缓冲

            this.Disposed += new EventHandler(OnDispose);
        }
Esempio n. 3
0
 /// <summary>
 /// 设置 View 的渲染模式
 /// </summary>
 /// <param name="mode">渲染模式</param>
 public void SetRenderMode(TRTCVideoFillMode mode)
 {
     mRenderMode = mode;
 }