Exemplo n.º 1
0
        /// <summary>
        /// 关闭音频通道_独占
        /// </summary>
        /// <returns></returns>
        public bool CloseSound()
        {
            bool bolResult = false;

            SDK_DaHua.DHCloseSound(this, null);
            return(bolResult);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 大华SDK释放
        /// </summary>
        /// <returns></returns>
        public static bool DHVideoSDK_Release()
        {
            bool bolResult = false;

            SDK_DaHua.CLIENT_Cleanup();
            DHVideoSDKState = Enum_SDKState.SDK_Release;
            return(bolResult);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 大华SDK初始化
        /// </summary>
        /// <returns></returns>
        public static bool DHVideoSDK_Init()
        {
            bool bolResult = false;

            SDK_DaHua.CLIENT_Init(null, IntPtr.Zero);
            DHVideoSDKState = Enum_SDKState.SDK_Init;
            return(bolResult);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 打开音频通道_独占
        /// </summary>
        /// <returns></returns>
        public bool OpenSound()
        {
            bool bolResult = false;

            //手动关闭,确认只有一个通道有声音
            SDK_DaHua.DHCloseSound(this, null);
            if (SDK_DaHua.CLIENT_OpenSound(intPlayID))
            {
                SoundState = Enum_VideoPlaySoundState.SoundOpen;
                bolResult  = true;
            }
            return(bolResult);
        }
Exemplo n.º 5
0
        public bool VideoClose()
        {
            bool bolResult = false;

            if (SoundState == Enum_VideoPlaySoundState.SoundOpen)
            {
                //关闭音频
                CloseSound();
            }
            SDK_DaHua.CLIENT_StopSaveRealData(intPlayID);
            VideoRecordStatus = false;
            SDK_DaHua.CLIENT_StopRealPlay(intPlayID);
            SDK_DaHua.CLIENT_Logout(intLoginID);
            VideoPlayState = Enum_VideoPlayState.NotInPlayState;
            VideoPlayCallback(new VideoPlayCallbackValue {
                evType = Enum_VideoPlayEventType.VideoClose
            });
            SDKState.DHVideoSDK_Release();
            return(bolResult);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 大华视频播放
        /// </summary>
        /// <returns></returns>
        public bool VideoPlay()
        {
            bool bolResult = false;

            if (SDKState.DHVideoSDKState != Enum_SDKState.SDK_Init)
            {
                SDKState.DHVideoSDK_Init();
            }
            SDK_DaHua.NET_DEVICEINFO deviceInfo = new SDK_DaHua.NET_DEVICEINFO();
            int intError;

            intLoginID = SDK_DaHua.CLIENT_Login(CurrentVideoInfo.DVSAddress, Convert.ToUInt16(CurrentVideoInfo.DVSConnectPort), CurrentVideoInfo.UserName, CurrentVideoInfo.Password, out deviceInfo, out intError);
            if (intLoginID != 0)
            {
                VideoPlayCallback(new VideoPlayCallbackValue {
                    evType = Enum_VideoPlayEventType.LoginSuccess
                });
                if (CurrentVideoPlaySet.PlayStream == Enum_VideoStream.MainStream)
                {
                    intPlayID   = SDK_DaHua.CLIENT_RealPlayEx(intLoginID, CurrentCameraInfo.Channel - 1, intptrPlayMain, SDK_DaHua.REALPLAY_TYPE.DH_RType_RealPlay);
                    videoStream = Enum_VideoStream.MainStream;
                }
                else
                {
                    intPlayID   = SDK_DaHua.CLIENT_RealPlayEx(intLoginID, CurrentCameraInfo.Channel - 1, intptrPlayMain, SDK_DaHua.REALPLAY_TYPE.DH_RType_RealPlay_1);
                    videoStream = Enum_VideoStream.SubStream;
                }

                if (intPlayID != 0)
                {
                    if (CurrentVideoPlaySet.VideoMonitorEnable)
                    {
                        OpenSound();
                    }
                    if (CurrentVideoPlaySet.VideoRecordEnable)
                    {
                        string Temp_strVideoRecord = GetLocalSavePath(CurrentVideoPlaySet.VideoRecordFilePath, CurrentVideoPlaySet.VideoRecordFileName);
                        SDK_DaHua.CLIENT_SaveRealData(intPlayID, Temp_strVideoRecord);
                        VideoRecordStatus = true;
                    }

                    VideoPlayCallback(new VideoPlayCallbackValue {
                        evType = Enum_VideoPlayEventType.VideoPlay
                    });
                    VideoPlayState = Enum_VideoPlayState.InPlayState;
                }
                else
                {
                    VideoPlayCallback(new VideoPlayCallbackValue {
                        evType = Enum_VideoPlayEventType.VideoPlayException
                    });
                }
            }
            else
            {
                VideoPlayState = Enum_VideoPlayState.NotInPlayState;
                VideoPlayCallback(new VideoPlayCallbackValue {
                    evType = Enum_VideoPlayEventType.DevLoginException
                });
            }
            return(bolResult);
        }