void airplayServer_VideoReceived(object sender, VideoEventArgs e) { airplayServer.SetPlaybackState(e.SessionId, PlaybackCategory.Video, PlaybackState.Loading); invoke(delegate() { //YouTube sometimes sends play video twice?? Ignore the second request if (e.SessionId == currentVideoSessionId && e.ContentLocation == currentVideoUrl) { Logger.Instance.Debug("Airplayer: Ignoring duplicate playback request"); return; } videoReceiveTime = DateTime.Now; stopCurrentItem(); cleanupPlayback(); GUIGraphicsContext.ResetLastActivity(); GUIWaitCursor.Init(); GUIWaitCursor.Show(); currentVideoSessionId = e.SessionId; currentVideoUrl = e.ContentLocation; //See if we are loading a HLS stream. //If so, manually select the best quality as LAVSplitter just selects the first/default. //If not, allow MPUrlSourceFilter as it has better seeking support but doesn't seem to like HLS streams :( hlsParser = new HlsParser(currentVideoUrl); hlsParser.Completed += hlsParser_Completed; hlsParser.Start(); }); }
void onPlayerStopped(MediaItem mediaItem) { if (mediaItem is VideoItem) { lock (videoInfoSync) { if (currentVideoSessionId != null) { airplayServer.SetPlaybackState(currentVideoSessionId, PlaybackCategory.Video, ShairportSharp.Airplay.PlaybackState.Stopped); cleanupVideoPlayback(); } } } else if (mediaItem is ImageItem) { lock (photoInfoSync) photoSessionId = null; } else if (mediaItem is AudioItem) { lock (audioInfoSync) { if (isAudioPlaying) { airtunesServer.SendCommand(RemoteCommand.Stop); cleanupAudioPlayback(); } } } }
public void LoadVideo(VideoEventArgs e) { hasStarted = false; hasFinished = false; sessionId = e.SessionId; server.SetPlaybackState(sessionId, PlaybackCategory.Video, PlaybackState.Loading); m_Playback.Stop(); m_Playback.FileName = e.ContentLocation; }