Пример #1
0
 /// <summary>
 /// 设置视频存储路径
 /// </summary>
 /// <param name="aPath"></param>
 public void SetVideoPath(string aPath)
 {
     if (string.IsNullOrEmpty(aPath))
     {
         return;
     }
     mVideoPath = aPath;
     if (ChannelId > 0)
     {
         PlayerMethods.CarEyePlayer_SetManuRecordPath(ChannelId, mVideoPath);
     }
 }
Пример #2
0
        /// <summary>
        /// 开始播放流媒体
        /// </summary>
        /// <returns></returns>
        public bool StartPlay()
        {
            if (ChannelId > 0)
            {
                return(true);
            }
            if (Token == null)
            {
                LogAppend("无效的监控终端。。。");
                return(false);
            }

            if (string.IsNullOrEmpty(this.Token.Url))
            {
                LogAppend("视频监控地址无效。。。");
                return(false);
            }

            // TCP连接 YUY2显示,软解码
            ChannelId = PlayerMethods.CarEyePlayer_OpenStream(this.Token.Url, this.lblView.Handle, RENDER_FORMAT.DISPLAY_FORMAT_YUY2,
                                                              1, string.Empty, string.Empty,
                                                              mPlayerCallBack, this.Handle, false);

            if (ChannelId <= 0)
            {
                this.btnPlay.Enabled = true;
                LogAppend("视频监控打开失败...");
                return(false);
            }

            // 设置缓存
            // 最大帧缓存为30,超过该值将只播放I帧
            PlayerMethods.CarEyePlayer_SetFrameCache(ChannelId, 3);
            mParent.PlayChnSound(ChannelId);
            // 按比例播放
            PlayerMethods.CarEyePlayer_SetShownToScale(ChannelId, 1);

            // 设置抓图和录制存放路径
            GenRecordPath();
            PlayerMethods.CarEyePlayer_SetManuRecordPath(ChannelId, mVideoPath);
            GenScreenPath();
            PlayerMethods.CarEyePlayer_SetManuPicShotPath(ChannelId, mImagePath);

            this.btnPlay.Checked = true;
            this.btnPlay.Enabled = true;
            UpdateDisplayStatus(true);
            return(true);
        }