コード例 #1
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);
        }