/// <summary>
        /// 打开音频通道
        /// </summary>
        /// <returns></returns>
        public bool OpenSound()
        {
            bool bolResult = false;

            SDK_JCSDK.JCSDK_SetAudioPreview(intCloundSee_ConnID, intptrPlayMain);
            return(bolResult);
        }
        /// <summary>
        /// 关闭音频通道
        /// </summary>
        /// <returns></returns>
        public bool CloseSound()
        {
            bool bolResult = false;

            SDK_JCSDK.JCSDK_SetAudioPreview(intCloundSee_ConnID, IntPtr.Zero);
            return(bolResult);
        }
        public bool VideoPTZControl(Enum_VideoPTZControl PTZControl, bool bolStart)
        {
            bool bolResult = false;

            SDK_JCSDK.JCPTZCmdType CloundSee_PTZControl = SDK_JCSDK.JCPTZCmdType.JCPCT_Auto;
            //云台控制类型改变
            switch (PTZControl) //云视通仅 上下
            {
            case Enum_VideoPTZControl.PTZControl_Up:
                CloundSee_PTZControl = SDK_JCSDK.JCPTZCmdType.JCPCT_Up;
                break;

            case Enum_VideoPTZControl.PTZControl_Down:
                CloundSee_PTZControl = SDK_JCSDK.JCPTZCmdType.JCPCT_Down;
                break;

            case Enum_VideoPTZControl.PTZControl_Left:
                CloundSee_PTZControl = SDK_JCSDK.JCPTZCmdType.JCPCT_Left;
                break;

            case Enum_VideoPTZControl.PTZControl_Right:
                CloundSee_PTZControl = SDK_JCSDK.JCPTZCmdType.JCPCT_Right;
                break;
            }
            if (CloundSee_PTZControl != SDK_JCSDK.JCPTZCmdType.JCPCT_Auto)
            {
                SDK_JCSDK.JCSDK_SendPTZCommand(intCloundSee_ConnID, CloundSee_PTZControl, bolStart);
            }
            return(bolResult);
        }
 /// <summary>
 /// 联动预置点
 /// </summary>
 /// <param name="intPrestValue"></param>
 /// <returns></returns>
 public bool LinkagePresetPoint(int intPrestValue)
 {
     if (VideoPlayState == Enum_VideoPlayState.InPlayState)
     {
         SDK_JCSDK.JCSDK_PresetCall(CurrentCameraInfo.Channel, intPrestValue);
     }
     return(true);
 }
        public bool VideoClose()
        {
            bool bolResult = false;

            if (intCloundSee_ConnID != -1)
            {
                CloundSee_VideoRecordStop();
                CloseSound();
                for (int i = intCloundSee_ConnID; i > -1; i--)
                {
                    SDK_JCSDK.JCSDK_Disconnect(i);
                }
            }
            return(bolResult);
        }
 /// <summary>
 /// 视频录像
 /// </summary>
 public void CloundSee_VideoRecordStart(string strRecFilePath)
 {
     if (string.IsNullOrEmpty(strRecFilePath))
     {
         //不存在路径 使用默认路径
         //默认路径格式 [当前工作路径/CloundSeeRecFile/云视通号码/时间(yyyyMMddHHmmss)_通道号(01).mp4]
         StringBuilder sbRecDicPath = new StringBuilder();
         sbRecDicPath.Append(ProgConstants.strCloundSee_RecDicPath); //默认路径
         sbRecDicPath.Append("\\" + CurrentVideoInfo.DVSAddress);    //云视通号码
         if (!Directory.Exists(sbRecDicPath.ToString()))
         {
             //文件夹不存在,创建文件夹
             Directory.CreateDirectory(sbRecDicPath.ToString());
         }
         StringBuilder sbRecFilePath = new StringBuilder();
         sbRecFilePath.Append(sbRecDicPath.ToString());
         sbRecFilePath.Append("\\" + DateTime.Now.ToString("yyyyMMddHHmmss"));             //时间
         sbRecFilePath.Append("_" + CurrentCameraInfo.Channel.ToString().PadLeft(2, '0')); //通道号
         sbRecFilePath.Append(".mp4");
         strRecFilePath = sbRecFilePath.ToString();
     }
     else if (!strRecFilePath.EndsWith(".mp4"))
     {
         //后缀名错误或者只指定文件夹
         if (!Directory.Exists(strRecFilePath.ToString()))
         {
             //文件夹不存在,创建文件夹
             Directory.CreateDirectory(strRecFilePath.ToString());
         }
         StringBuilder sbRecFilePath = new StringBuilder();
         sbRecFilePath.Append(strRecFilePath);
         sbRecFilePath.Append("\\" + CurrentVideoInfo.DVSNumber);                                //视频设备编号
         sbRecFilePath.Append("_" + CurrentCameraInfo.Channel.ToString().PadLeft(2, '0'));       //通道号
         sbRecFilePath.Append("_" + DateTime.Now.ToString("yyyyMMddHHmmss"));                    //时间
         sbRecFilePath.Append("_" + "91.mp4");                                                   //分类后缀及文件格式
         strRecFilePath = sbRecFilePath.ToString();
     }
     SDK_JCSDK.JCSDK_StartRec(intCloundSee_ConnID, strRecFilePath);
     VideoRecordStatus = true;
 }
        private bool VideoPlay_VideoPreview(bool bolOnlySetPreview = true)
        {
            bool bolResult = false;

            SDK_JCSDK.JCSDK_EnableDecoder(intCloundSee_ConnID, true);
            SDK_JCSDK.JCSDK_SetVideoPreview(intCloundSee_ConnID, intptrPlayMain, intptrCloundSee_PlayRect);
            if (!bolOnlySetPreview)
            {
                if (CurrentVideoPlaySet.VideoRecordEnable)      //录像使能
                {
                    CloundSee_VideoRecordStart(CurrentVideoPlaySet.VideoRecordFilePath);
                }
                if (CurrentVideoPlaySet.VideoMonitorEnable)     //音频使能
                {
                    OpenSound();
                }
                if (CurrentVideoPlaySet.PreSetPosi != -1)        //预置点
                {
                }
            }
            return(bolResult);
        }
 /// <summary>
 /// 停止视频录像
 /// </summary>
 private void CloundSee_VideoRecordStop()
 {
     SDK_JCSDK.JCSDK_StopRec(intCloundSee_ConnID);
     VideoRecordStatus = false;
 }
        public bool VideoPlay()
        {
            bool bolReusult = false;
            bool bolCouldID = !CommonMethod.Verification.isIP(CurrentVideoInfo.DVSAddress);

            if (bolCouldID)
            {
                //使用云视通号
                //大于0设备在线  0 参数错误  -1设备离线  -2设备版本过早  -3其他原因
                int Temp_NetworkState = SDK_JCSDK.JCSDK_GetYstOnlineStatus(CurrentVideoInfo.DVSAddress, 1);
                if (Temp_NetworkState > 0)
                {
                    //设备在线
                    CurrentVideoInfo.NetworkState = 1;
                }
                else if (Temp_NetworkState == -1 || Temp_NetworkState == 0 || Temp_NetworkState == -2)
                {
                    //离线
                    CurrentVideoInfo.NetworkState = 0;
                }
                else
                {
                    //状态为明
                    CurrentVideoInfo.NetworkState = -1;
                }
            }
            else
            {
                //使IP地址 状态置为 未明
                CurrentVideoInfo.NetworkState = -1;
            }

            if (intCloundSee_ConnID != -1)
            {
                VideoClose();
            }
            if (CurrentVideoInfo.NetworkState != 0)
            {
                intCloundSee_ConnID = SDK_JCSDK.JCSDK_Connect(CurrentVideoInfo.DVSAddress,
                                                              CurrentVideoInfo.DVSConnectPort,
                                                              CurrentCameraInfo.Channel,
                                                              CurrentVideoInfo.UserName,
                                                              CurrentVideoInfo.Password,
                                                              bolCouldID,
                                                              "");
                VideoPlayCallback(new VideoPlayCallbackValue {
                    evType = Enum_VideoPlayEventType.ConnSuccess
                });
                if (intCloundSee_ConnID == -1)
                {
                    //连接失败
                    VideoPlayCallback(new VideoPlayCallbackValue {
                        evType = Enum_VideoPlayEventType.ConnFailed
                    });
                }
            }
            else
            {
                //生成网络状态状态异常事件
                VideoPlayCallback(new VideoPlayCallbackValue {
                    evType = Enum_VideoPlayEventType.VideoDeviceNotOnline
                });
                CurrentVideoPlaySet.AutoReconn = false;
            }

            return(bolReusult);
        }
 public VideoPlay_CloundSee()
 {
     gEventCallback = new SDK_JCSDK.JCEventCallback_t(CloundSee_JCEventCallback);
     SDK_JCSDK.JCSDK_RegisterCallback(gEventCallback, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
 }
示例#11
0
        public void JCSDK_InitSDKTest()
        {
            bool bolResult = SDK_JCSDK.JCSDK_InitSDK(0);

            Assert.IsTrue(bolResult);
        }