Exemplo n.º 1
0
        /// <summary>
        /// 控制录像点播播放速度
        /// </summary>
        /// <param name="scale">播放速度</param>
        /// <param name="range">时间范围</param>
        public void BackVideoPlaySpeedControlReq(string scale, DateTime range)
        {
            if (_msgCore.LocalEndPoint == null)
            {
                OnSIPServiceChange(_deviceName + "-" + _deviceId, SipServiceStatus.Wait);
                return;
            }
            if (_mediaPort == null)
            {
                _mediaPort = _msgCore.SetMediaPort();
            }

            uint   time    = TimeConvert.DateToTimeStamp(range);
            string localIp = _msgCore.LocalEndPoint.Address.ToString();
            string fromTag = CallProperties.CreateNewTag();
            int    cSeq    = CallProperties.CreateNewCSeq();
            string callId  = CallProperties.CreateNewCallId();

            //this.Stop();
            SIPRequest realReq = BackVideoPlaySpeedControlReq(localIp, _mediaPort, scale, time, fromTag, cSeq, callId);

            _msgCore.Transport.SendRequest(_msgCore.RemoteEndPoint, realReq);
            _realTask = new TaskTiming(realReq, _msgCore.Transport);
            _msgCore.SendRequestTimeout += _realTask.MessageSendRequestTimeout;
            _realTask.OnCloseRTPChannel += Task_OnCloseRTPChannel;
            _realTask.Start();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 录像点播视频请求
        /// </summary>
        /// <param name="beginTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        public void BackVideoReq(DateTime beginTime, DateTime endTime)
        {
            lock (_msgCore.RemoteTrans)
            {
                if (!_msgCore.RemoteTrans.ContainsKey(_remoteEndPoint.ToString()))
                {
                    OnSIPServiceChange(_deviceName + "-" + _deviceId + _remoteEndPoint.ToString(), SipServiceStatus.Wait);
                    return;
                }
            }
            //if (_mediaPort == null)
            //{
            //    _mediaPort = _msgCore.SetMediaPort();

            //}
            _mediaPort = _msgCore.SetMediaPort();
            uint startTime = TimeConvert.DateToTimeStamp(beginTime);
            uint stopTime  = TimeConvert.DateToTimeStamp(endTime);

            this.Stop();
            SIPRequest realReq = BackVideoReq(_mediaPort, startTime, stopTime);

            _msgCore.Transport.SendRequest(_remoteEndPoint, realReq);
            //_realTask = new TaskTiming(realReq, _msgCore.Transport);
            //_msgCore.SendRequestTimeout += _realTask.MessageSendRequestTimeout;
            //_realTask.OnCloseRTPChannel += Task_OnCloseRTPChannel;
            //_realTask.Start();
        }