public static void DACPlaying(DACPlayInfo playInfo, PPTVData.Entity.ChannelDetailInfo channelInfo,Version clientVersion) { string content = "Action=0&A=" + playInfo.castType.ToString() + "&B=1&C=6&D=" + GetUserId() + "&E="; content += (clientVersion==null?"":clientVersion.ToString()); content += "&F=" + channelInfo.TypeID.ToString(); content += "&G=" + channelInfo.VID.ToString(); content += "&H=" + channelInfo.Title; content += "&I=" + playInfo.playTime.ToString("0"); content += "&J=" + playInfo.mp4Name; content += "&K=" + playInfo.programSource.ToString(); content += "&L=" + playInfo.prepareTime.ToString("0"); content += "&M=" + playInfo.bufferTime.ToString("0"); content += "&N=" + playInfo.allBufferCount.ToString(); content += "&O=" + playInfo.dragCount.ToString(); content += "&P=" + playInfo.dragBufferTime.ToString("0"); content += "&Q=" + playInfo.playBufferCount.ToString(); content += "&R=" + playInfo.connType.ToString(); content += "&S=" + playInfo.isPlaySucceeded.ToString(); content += "&T="; content += "&U="; content += "&V=" + playInfo.averageDownSpeed.ToString(); content += "&W=" + playInfo.stopReason.ToString(); content += "&Y1=0"; content += "&Y2=" + DeviceExtendedProperties.GetValue("DeviceName").ToString(); content += "&Y3=" + System.Environment.OSVersion.Version.ToString(); _instance = new DACFactory(); _instance.DACSend(content); }
public static void DACPlaying(DACPlayInfo playInfo, PPTVData.Entity.ChannelDetailInfo channelInfo, Version clientVersion) { string content = "Action=0&A=" + playInfo.castType.ToString() + "&B=1&C=6&D=" + GetUserId() + "&E="; content += (clientVersion == null?"":clientVersion.ToString()); content += "&F=" + channelInfo.TypeID.ToString(); content += "&G=" + channelInfo.VID.ToString(); content += "&H=" + channelInfo.Title; content += "&I=" + playInfo.playTime.ToString("0"); content += "&J=" + playInfo.mp4Name; content += "&K=" + playInfo.programSource.ToString(); content += "&L=" + playInfo.prepareTime.ToString("0"); content += "&M=" + playInfo.bufferTime.ToString("0"); content += "&N=" + playInfo.allBufferCount.ToString(); content += "&O=" + playInfo.dragCount.ToString(); content += "&P=" + playInfo.dragBufferTime.ToString("0"); content += "&Q=" + playInfo.playBufferCount.ToString(); content += "&R=" + playInfo.connType.ToString(); content += "&S=" + playInfo.isPlaySucceeded.ToString(); content += "&T="; content += "&U="; content += "&V=" + playInfo.averageDownSpeed.ToString(); content += "&W=" + playInfo.stopReason.ToString(); content += "&Y1=0"; content += "&Y2=" + DeviceExtendedProperties.GetValue("DeviceName").ToString(); content += "&Y3=" + System.Environment.OSVersion.Version.ToString(); _instance = new DACFactory(); _instance.DACSend(content); }
private void xPPvodWP7MediaElement_MediaFailed(object sender, PPTVWP7MediaPlayer.PPLiveExceptionRoutedEventArgs e) { if (_playLocalFile) { MessageBox.Show("无法播放该影片"); if (NavigationService.CanGoBack) { NavigationService.GoBack(); } return; } int oldBitrate = _currentPlayBitrate != null ? _currentPlayBitrate.FileType : -1; if (PlayFirstCondidacyBitrate(true)) { if (oldBitrate == 0 || oldBitrate == 1) { SetInfo(true, "当前高清版本无法播放,正在请求其他版本!"); } return; } Debug.WriteLine("错误异常:" + e.ErrorException.Message); SetInfo(false); _playBufferCount = _allBufferCount - _dragBufferCount; PPTVData.Factory.DACPlayInfo playInfo = new PPTVData.Factory.DACPlayInfo(); playInfo.castType = 3; playInfo.stopReason = 2; playInfo.isPlaySucceeded = _isPlaySucceeded ? 1 : 0; playInfo.connType = _connType; playInfo.dragCount = _dragCount; playInfo.playBufferCount = _playBufferCount; playInfo.dragBufferTime = _dragBufferTime; playInfo.allBufferCount = _allBufferCount; playInfo.bufferTime = _bufferTime; playInfo.prepareTime = _prepareTime; playInfo.programSource = _programSource; playInfo.averageDownSpeed = _averageDownSpeed; playInfo.playTime = _playTime; if (_currentPlayBitrate != null) { playInfo.mp4Name = Utils.Utils.UrlDecode(_currentPlayBitrate.Rid); } if (ChannelDetailInfo != null) { PPTVData.Factory.DACFactory.DACPlaying(playInfo, ChannelDetailInfo, Utils.Utils.GetClientVersion()); } _isPlaySucceeded = false; ChannelDetailInfo = null; MessageBox.Show(e.ErrorException.Message); if (NavigationService.CanGoBack) { NavigationService.GoBack(); } }
public void Play(DACPlayInfo playInfo, int playType) { var clientByPlayEnd = new WebClient(); var builder = new StringBuilder(100); builder.AppendFormat("Action=0&A={0}&B=1&C={1}&C1={2}&VVID={3}&D={4}", playType, C, C1, playInfo.vvid, D); if (PersonalFactory.Instance.Logined) { var d1 = PersonalFactory.Instance.DataInfos[0].UserStateInfo.VIP == 0 ? "1" : "2"; builder.AppendFormat("&D1={0}&D2={1}", d1, PersonalFactory.Instance.DataInfos[0].UserStateInfo.UserName); } else { builder.Append("&D1=0"); } builder.AppendFormat("&D3={0}", WAYGetFactory.WayGetInfo.UserType); builder.AppendFormat("&E={0}", EpgUtils.ClientVersion); builder.AppendFormat("&F={0}&F1=1", playInfo.type); builder.AppendFormat("&G={0}", playInfo.vid); builder.AppendFormat("&H={0}", playInfo.title); builder.AppendFormat("&I={0}", playInfo.playTime); builder.AppendFormat("&J={0}", playInfo.mp4Name); builder.AppendFormat("&FT={0}", playInfo.ft); builder.AppendFormat("&FN={0}", playInfo.fn); builder.AppendFormat("&FM={0}", playInfo.allTime); builder.AppendFormat("&K={0}", playInfo.programSource); builder.AppendFormat("&L={0}", playInfo.prepareTime); builder.AppendFormat("&M={0}", playInfo.bufferTime); builder.AppendFormat("&N={0}", playInfo.allBufferCount); builder.AppendFormat("&O={0}", playInfo.dragCount); builder.AppendFormat("&P={0}", playInfo.dragBufferTime); builder.AppendFormat("&Q={0}", playInfo.playBufferCount); builder.AppendFormat("&R={0}", playInfo.connType); builder.AppendFormat("&S={0}", playInfo.isPlaySucceeded); builder.AppendFormat("&T={0}", 1); builder.AppendFormat("&U={0}", string.Empty); builder.AppendFormat("&V={0}", playInfo.averageDownSpeed); builder.AppendFormat("&W={0}", playInfo.stopReason); builder.AppendFormat("&Y1={0}", Y1); builder.AppendFormat("&Y2={0}", Y2); builder.AppendFormat("&Y3={0}", Y2); var uri = CreateUri(builder.ToString()); clientByPlayEnd.DownloadStringAsync(uri); }
private void xPPvodWP7MediaElement_MediaEnded(object sender, PPTVWP7MediaPlayer.PPLiveRoutedEventArgs e) { _isPlayEnd = true; _isOver = true; if (_playLocalFile) { // LocalPlayFactory localFactory = new LocalPlayFactory(); localFactory.UpdateRecord(_localFileId, xPPvodWP7MediaElement.Position.Seconds); if (NavigationService.CanGoBack) { NavigationService.GoBack(); } return; } SaveToDB(ProgramIndex); xPPvodWP7MediaElement.Stop(); _playBufferCount = _allBufferCount - _dragBufferCount; PPTVData.Factory.DACPlayInfo playInfo = new PPTVData.Factory.DACPlayInfo(); playInfo.castType = 3; playInfo.stopReason = 0; playInfo.isPlaySucceeded = _isPlaySucceeded ? 1 : 0; playInfo.connType = _connType; playInfo.dragCount = _dragCount; playInfo.playBufferCount = _playBufferCount; playInfo.dragBufferTime = _dragBufferTime; playInfo.allBufferCount = _allBufferCount; playInfo.bufferTime = _bufferTime; playInfo.prepareTime = _prepareTime; playInfo.programSource = _programSource; playInfo.averageDownSpeed = _averageDownSpeed; playInfo.playTime = _playTime; playInfo.mp4Name = Utils.Utils.UrlDecode(_currentPlayBitrate != null ? _currentPlayBitrate.Rid : ""); PPTVData.Factory.DACFactory.DACPlaying(playInfo, ChannelDetailInfo, Utils.Utils.GetClientVersion()); _isAutoStop = true; PlayNextProgram(); }
private void xPPvodWP7MediaElement_CurrentStateChanged(object sender, PPTVWP7MediaPlayer.PPLiveRoutedEventArgs e) { switch (xPPvodWP7MediaElement.CurrentState) { case MediaElementState.AcquiringLicense: break; case MediaElementState.Buffering: _bufferingPosition = xPPvodWP7MediaElement.Position.TotalSeconds; SetInfo(true, "正在缓冲影片"); SetControlBarStatus(false, true); break; case MediaElementState.Closed: _timer.Stop(); break; case MediaElementState.Individualizing: break; case MediaElementState.Opening: SetInfo(true, "正在打开影片"); BeginSetChannelToVideoHub(ChannelDetailInfo); break; case MediaElementState.Paused: SetControlBarStatus(false, true); break; case MediaElementState.Playing: //判断是否有播放过,如果有播放过 则从用户播放过的位置开始播放 _isDrag = false; if (_isPlayDBPosition) { if (_playLocalFile) { // 接着从上次停止的地方接着观看 LocalPlayFactory localFactory = new LocalPlayFactory(); xPPvodWP7MediaElement.Position = TimeSpan.FromSeconds(localFactory.GetPosition(_localFileId)); } else { var playHistroy = PlayHistoryFactory.Instance.GetEntity(VID); if (playHistroy != null) { _timer.Stop(); if (playHistroy.ProgramIndex == ProgramIndex) { xPPvodWP7MediaElement.Position = TimeSpan.FromSeconds(playHistroy.Position); } } } } SetControlBarStatus(); SetInfo(false); break; case MediaElementState.Stopped: { _playTime = (DateTime.Now - _beginPlaying).TotalSeconds; _timer.Stop(); SetInfo(false); SetControlBarStatus(false, true); if (!_isAutoStop) { _isAutoStop = false; _playBufferCount = _allBufferCount - _dragBufferCount; PPTVData.Factory.DACPlayInfo playInfo = new PPTVData.Factory.DACPlayInfo(); playInfo.castType = 3; playInfo.stopReason = 0; playInfo.isPlaySucceeded = _isPlaySucceeded ? 1 : 0; playInfo.connType = _connType; playInfo.dragCount = _dragCount; playInfo.playBufferCount = _playBufferCount; playInfo.dragBufferTime = _dragBufferTime; playInfo.allBufferCount = _allBufferCount; playInfo.bufferTime = _bufferTime; playInfo.prepareTime = _prepareTime; playInfo.programSource = _programSource; playInfo.averageDownSpeed = _averageDownSpeed; playInfo.playTime = _playTime; playInfo.mp4Name = Utils.Utils.UrlDecode(_currentPlayBitrate != null ? _currentPlayBitrate.Rid : ""); PPTVData.Factory.DACFactory.DACPlaying(playInfo, ChannelDetailInfo, Utils.Utils.GetClientVersion()); } } break; default: break; } //xDebugTextBlock.Text = xPPvodWP7MediaElement.CurrentState.ToString(); xPlayerControlBar.SetPlayerControlBarStuas(xPPvodWP7MediaElement.CurrentState); if (xPPvodWP7MediaElement.CurrentState != MediaElementState.Buffering) { _isDrag = false; } }
protected override void OnNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e) { _timer.Stop(); _timerOfControlBar.Stop(); if (_playLocalFile) { xPPvodWP7MediaElement.Pause(); if (xPPvodWP7MediaElement.CurrentState == MediaElementState.Paused || xPPvodWP7MediaElement.CurrentState == MediaElementState.Playing) {// 更新当前的播放位置 LocalPlayFactory localFacotry = new LocalPlayFactory(); localFacotry.UpdateRecord(_localFileId, (long)xPPvodWP7MediaElement.Position.TotalSeconds); } return; } LogManager.Ins.Log("开始退出执行DAC"); if (xPPvodWP7MediaElement.CurrentState != MediaElementState.Stopped) { _playTime = (DateTime.Now - _beginPlaying).TotalSeconds; _playBufferCount = _allBufferCount - _dragBufferCount; PPTVData.Factory.DACPlayInfo playInfo = new PPTVData.Factory.DACPlayInfo(); playInfo.castType = 3; playInfo.stopReason = 1; playInfo.isPlaySucceeded = _isPlaySucceeded ? 1 : 0; LogManager.Ins.Log("查Wifi开始"); playInfo.connType = _connType; LogManager.Ins.Log("查Wifi结束"); playInfo.dragCount = _dragCount; playInfo.playBufferCount = _playBufferCount; playInfo.dragBufferTime = _dragBufferTime; playInfo.allBufferCount = _allBufferCount; playInfo.bufferTime = _bufferTime; playInfo.prepareTime = _prepareTime; playInfo.programSource = _programSource; playInfo.averageDownSpeed = _averageDownSpeed; playInfo.playTime = _playTime; playInfo.mp4Name = Utils.Utils.UrlDecode(_currentPlayBitrate != null ? _currentPlayBitrate.Rid : ""); if (ChannelDetailInfo != null && !_isAutoStop) { PPTVData.Factory.DACFactory.DACPlaying(playInfo, ChannelDetailInfo, Utils.Utils.GetClientVersion()); } _isAutoStop = false; } LogManager.Ins.Log("DAC完成"); SetInfo(true); LogManager.Ins.Log("开始保存到数据库"); if (xPPvodWP7MediaElement.CurrentState == MediaElementState.Paused || xPPvodWP7MediaElement.CurrentState == MediaElementState.Playing) { SaveToDB(ProgramIndex); } LogManager.Ins.Log("数据库保存完成"); //if (_isBackPress) // xPPvodWP7MediaElement.OriSource = ""; ChannelDetailInfo = null; _currentPlayBitrate = null; LogManager.Ins.Log("清空Source"); }
private void xPPvodWP7MediaElement_CurrentStateChanged(object sender, PPTVWP7MediaPlayer.PPLiveRoutedEventArgs e) { switch (xPPvodWP7MediaElement.CurrentState) { case MediaElementState.AcquiringLicense: break; case MediaElementState.Buffering: _bufferingPosition = xPPvodWP7MediaElement.Position.TotalSeconds; SetInfo(true, "正在缓冲影片"); SetControlBarStatus(false, true); break; case MediaElementState.Closed: _timer.Stop(); break; case MediaElementState.Individualizing: break; case MediaElementState.Opening: SetInfo(true, "正在打开影片"); BeginSetChannelToVideoHub(ChannelDetailInfo); break; case MediaElementState.Paused: SetControlBarStatus(false, true); break; case MediaElementState.Playing: //判断是否有播放过,如果有播放过 则从用户播放过的位置开始播放 _isDrag = false; if (_isPlayDBPosition) { if (_playLocalFile) { // 接着从上次停止的地方接着观看 LocalPlayFactory localFactory = new LocalPlayFactory(); xPPvodWP7MediaElement.Position = TimeSpan.FromSeconds(localFactory.GetPosition(_localFileId)); } else { var playHistroy = PlayHistoryFactory.Instance.GetEntity(VID); if (playHistroy != null) { _timer.Stop(); if (playHistroy.ProgramIndex == ProgramIndex) xPPvodWP7MediaElement.Position = TimeSpan.FromSeconds(playHistroy.Position); } } } SetControlBarStatus(); SetInfo(false); break; case MediaElementState.Stopped: { _playTime = (DateTime.Now - _beginPlaying).TotalSeconds; _timer.Stop(); SetInfo(false); SetControlBarStatus(false, true); if (!_isAutoStop) { _isAutoStop = false; _playBufferCount = _allBufferCount - _dragBufferCount; PPTVData.Factory.DACPlayInfo playInfo = new PPTVData.Factory.DACPlayInfo(); playInfo.castType = 3; playInfo.stopReason = 0; playInfo.isPlaySucceeded = _isPlaySucceeded ? 1 : 0; playInfo.connType = _connType; playInfo.dragCount = _dragCount; playInfo.playBufferCount = _playBufferCount; playInfo.dragBufferTime = _dragBufferTime; playInfo.allBufferCount = _allBufferCount; playInfo.bufferTime = _bufferTime; playInfo.prepareTime = _prepareTime; playInfo.programSource = _programSource; playInfo.averageDownSpeed = _averageDownSpeed; playInfo.playTime = _playTime; playInfo.mp4Name = Utils.Utils.UrlDecode(_currentPlayBitrate != null ? _currentPlayBitrate.Rid : ""); PPTVData.Factory.DACFactory.DACPlaying(playInfo, ChannelDetailInfo, Utils.Utils.GetClientVersion()); } } break; default: break; } //xDebugTextBlock.Text = xPPvodWP7MediaElement.CurrentState.ToString(); xPlayerControlBar.SetPlayerControlBarStuas(xPPvodWP7MediaElement.CurrentState); if (xPPvodWP7MediaElement.CurrentState != MediaElementState.Buffering) _isDrag = false; }
private void xPPvodWP7MediaElement_MediaFailed(object sender, PPTVWP7MediaPlayer.PPLiveExceptionRoutedEventArgs e) { if (_playLocalFile) { MessageBox.Show("无法播放该影片"); if (NavigationService.CanGoBack) NavigationService.GoBack(); return; } int oldBitrate = _currentPlayBitrate != null ? _currentPlayBitrate.FileType : -1; if (PlayFirstCondidacyBitrate(true)) { if (oldBitrate == 0 || oldBitrate == 1) { SetInfo(true, "当前高清版本无法播放,正在请求其他版本!"); } return; } Debug.WriteLine("错误异常:" + e.ErrorException.Message); SetInfo(false); _playBufferCount = _allBufferCount - _dragBufferCount; PPTVData.Factory.DACPlayInfo playInfo = new PPTVData.Factory.DACPlayInfo(); playInfo.castType = 3; playInfo.stopReason = 2; playInfo.isPlaySucceeded = _isPlaySucceeded ? 1 : 0; playInfo.connType = _connType; playInfo.dragCount = _dragCount; playInfo.playBufferCount = _playBufferCount; playInfo.dragBufferTime = _dragBufferTime; playInfo.allBufferCount = _allBufferCount; playInfo.bufferTime = _bufferTime; playInfo.prepareTime = _prepareTime; playInfo.programSource = _programSource; playInfo.averageDownSpeed = _averageDownSpeed; playInfo.playTime = _playTime; if (_currentPlayBitrate != null) playInfo.mp4Name = Utils.Utils.UrlDecode(_currentPlayBitrate.Rid); if (ChannelDetailInfo != null) PPTVData.Factory.DACFactory.DACPlaying(playInfo, ChannelDetailInfo, Utils.Utils.GetClientVersion()); _isPlaySucceeded = false; ChannelDetailInfo = null; MessageBox.Show(e.ErrorException.Message); if (NavigationService.CanGoBack) NavigationService.GoBack(); }
private void xPPvodWP7MediaElement_MediaEnded(object sender, PPTVWP7MediaPlayer.PPLiveRoutedEventArgs e) { _isPlayEnd = true; _isOver = true; if (_playLocalFile) { // LocalPlayFactory localFactory = new LocalPlayFactory(); localFactory.UpdateRecord(_localFileId, xPPvodWP7MediaElement.Position.Seconds); if (NavigationService.CanGoBack) NavigationService.GoBack(); return; } SaveToDB(ProgramIndex); xPPvodWP7MediaElement.Stop(); _playBufferCount = _allBufferCount - _dragBufferCount; PPTVData.Factory.DACPlayInfo playInfo = new PPTVData.Factory.DACPlayInfo(); playInfo.castType = 3; playInfo.stopReason = 0; playInfo.isPlaySucceeded = _isPlaySucceeded ? 1 : 0; playInfo.connType = _connType; playInfo.dragCount = _dragCount; playInfo.playBufferCount = _playBufferCount; playInfo.dragBufferTime = _dragBufferTime; playInfo.allBufferCount = _allBufferCount; playInfo.bufferTime = _bufferTime; playInfo.prepareTime = _prepareTime; playInfo.programSource = _programSource; playInfo.averageDownSpeed = _averageDownSpeed; playInfo.playTime = _playTime; playInfo.mp4Name = Utils.Utils.UrlDecode(_currentPlayBitrate != null ? _currentPlayBitrate.Rid : ""); PPTVData.Factory.DACFactory.DACPlaying(playInfo, ChannelDetailInfo, Utils.Utils.GetClientVersion()); _isAutoStop = true; PlayNextProgram(); }
protected override void OnNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e) { _timer.Stop(); _timerOfControlBar.Stop(); if (_playLocalFile) { xPPvodWP7MediaElement.Pause(); if (xPPvodWP7MediaElement.CurrentState == MediaElementState.Paused || xPPvodWP7MediaElement.CurrentState == MediaElementState.Playing) {// 更新当前的播放位置 LocalPlayFactory localFacotry = new LocalPlayFactory(); localFacotry.UpdateRecord(_localFileId, (long)xPPvodWP7MediaElement.Position.TotalSeconds); } return; } LogManager.Ins.Log("开始退出执行DAC"); if (xPPvodWP7MediaElement.CurrentState != MediaElementState.Stopped) { _playTime = (DateTime.Now - _beginPlaying).TotalSeconds; _playBufferCount = _allBufferCount - _dragBufferCount; PPTVData.Factory.DACPlayInfo playInfo = new PPTVData.Factory.DACPlayInfo(); playInfo.castType = 3; playInfo.stopReason = 1; playInfo.isPlaySucceeded = _isPlaySucceeded ? 1 : 0; LogManager.Ins.Log("查Wifi开始"); playInfo.connType = _connType; LogManager.Ins.Log("查Wifi结束"); playInfo.dragCount = _dragCount; playInfo.playBufferCount = _playBufferCount; playInfo.dragBufferTime = _dragBufferTime; playInfo.allBufferCount = _allBufferCount; playInfo.bufferTime = _bufferTime; playInfo.prepareTime = _prepareTime; playInfo.programSource = _programSource; playInfo.averageDownSpeed = _averageDownSpeed; playInfo.playTime = _playTime; playInfo.mp4Name = Utils.Utils.UrlDecode(_currentPlayBitrate != null ? _currentPlayBitrate.Rid : ""); if (ChannelDetailInfo != null && !_isAutoStop) PPTVData.Factory.DACFactory.DACPlaying(playInfo, ChannelDetailInfo, Utils.Utils.GetClientVersion()); _isAutoStop = false; } LogManager.Ins.Log("DAC完成"); SetInfo(true); LogManager.Ins.Log("开始保存到数据库"); if (xPPvodWP7MediaElement.CurrentState == MediaElementState.Paused || xPPvodWP7MediaElement.CurrentState == MediaElementState.Playing) SaveToDB(ProgramIndex); LogManager.Ins.Log("数据库保存完成"); //if (_isBackPress) // xPPvodWP7MediaElement.OriSource = ""; ChannelDetailInfo = null; _currentPlayBitrate = null; LogManager.Ins.Log("清空Source"); }