예제 #1
0
        public void onRenderVideoFrame(string userId, TRTCVideoStreamType streamType, TRTCVideoFrame frame)
        {
            // 大小视频是占一个视频位,底层支持动态切换。
            if (streamType == TRTCVideoStreamType.TRTCVideoStreamTypeSmall)
            {
                streamType = TRTCVideoStreamType.TRTCVideoStreamTypeBig;
            }
            TXLiteAVVideoView view = null;

            lock (mMapViews)
            {
                foreach (var item in mMapViews)
                {
                    if (item.Key.Equals(GetKey(userId, streamType)) && item.Value != null)
                    {
                        view = item.Value;
                        break;
                    }
                }
            }

            if (view != null)
            {
                view.AppendVideoFrame(frame.data, (int)frame.width, (int)frame.height, frame.videoFormat, frame.rotation);
            }
        }
예제 #2
0
 public void RemoveView(string userId, TRTCVideoStreamType type, TXLiteAVVideoView view)
 {
     lock (mMapViews)
     {
         foreach (var item in mMapViews.ToList())
         {
             if (item.Key.Equals(GetKey(userId, type)))
             {
                 if (item.Value != null)
                 {
                     item.Value.Dispose();
                 }
                 mMapViews.Remove(item.Key);
                 break;
             }
         }
     }
 }
예제 #3
0
 public void AddView(string userId, TRTCVideoStreamType type, TXLiteAVVideoView view)
 {
     lock (mMapViews)
     {
         bool find = false;
         foreach (var item in mMapViews)
         {
             if (item.Key.Equals(GetKey(userId, type)))
             {
                 find = true;
                 break;
             }
         }
         if (!find)
         {
             mMapViews.Add(GetKey(userId, type), view);
         }
     }
 }