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"); }