void airplay_ShowPhoto(object sender, PhotoEventArgs e) { Image image; try { using (MemoryStream ms = new MemoryStream(e.Photo)) image = Image.FromStream(ms); } catch { image = null; } BeginInvoke((MethodInvoker) delegate() { showPhoto(image); }); }
void airplayServer_ShowPhoto(object sender, PhotoEventArgs e) { invoke(delegate() { //When playing a video from the camera roll the client sends a thumbnail before the video. //Occasionally we receive it after due to threading so we should ignore it if we have just started playing a video. if (!isVideoPlaying || DateTime.Now.Subtract(videoReceiveTime).TotalSeconds > 2) { if (photoWindow != null) { photoSessionId = e.SessionId; photoWindow.SetPhoto(e.AssetKey, e.Photo); GUIGraphicsContext.ResetLastActivity(); if (GUIWindowManager.ActiveWindow != PhotoWindow.WINDOW_ID) { GUIWindowManager.ActivateWindow(PhotoWindow.WINDOW_ID); } } } }, false); }
void airplayServer_ShowPhoto(object sender, PhotoEventArgs e) { //When playing a video from the camera roll the client sends a thumbnail before the video. //Occasionally we receive it after due to threading so we should ignore it if we have just started playing a video. lock (videoInfoSync) if (currentVideoSessionId != null && DateTime.Now.Subtract(videoReceiveTime).TotalSeconds < 2) { return; } lock (photoInfoSync) photoSessionId = e.SessionId; ImageItem item = new ImageItem(e.AssetKey, e.Photo); var ic = getPlayerContext <AirplayImagePlayer>(); if (ic != null) { ic.DoPlay(item); } else { PlayItemsModel.CheckQueryPlayAction(item); } }