public void OnReceiveChoiceConfirmation(TCPConnection connection, int choiceIndex) { //choice index is either 0 or 1 if (currentVideo != null && currentVideo.Settings.choices.Length > 0) { string nextVideo = choiceIndex == 0 ? currentVideo.Settings.choices[0].video1 : currentVideo.Settings.choices[0].video2; VideoDisplay nextVideoDisplay = VideosDisplayer.Instance.FindVideo(nextVideo); if (nextVideoDisplay != null && nextVideoDisplay.Available) { playImmediately = true; LoadVideo(nextVideoDisplay); } else { Haze.Logger.LogError("Doesn't have video: " + nextVideo); onNextVideoIsUnavailable.Invoke(); Stop(); } } }
Rectangle _windowed;// Stored position and size for windowed mode public Xstream() { InitializeComponent(); VideoDisplay display = _displays[GetWindowDisplayIndex()]; Rectangle bounds = GetDisplayBounds(display); _windowed.Width = Program.Nano.Configuration.VideoMaximumWidth; _windowed.Height = Program.Nano.Configuration.VideoMaximumHeight; _windowed.X = bounds.X + (bounds.Width - _windowed.Width) / 2; _windowed.Y = bounds.Y + (bounds.Height - _windowed.Height) / 2; if (Config.Fullscreen) { //if (Config.Borderless) //{ // FormBorderStyle = FormBorderStyle.None; // WindowState = FormWindowState.Maximized; //} UpdateFullscreenMode(true); } else { ClientSize = new Size(_windowed.Width, _windowed.Height); } // If the window was created fullscreen, make sure the mode code matches UpdateFullscreenMode(Config.Fullscreen); string baseDir = AppDomain.CurrentDomain.BaseDirectory; Bitmap map = new Bitmap($"{baseDir}/Images/icon.png"); Icon = Icon.FromHandle(map.GetHicon()); FormClosed += (object sender, FormClosedEventArgs e) => { Native.DestroyIcon(Icon.Handle); }; Text = Config.CurrentMapping.TokenFilePath; KeyPreview = Config.KeyPreview; KeyDown += (sender, e) => { if (!KeyPreview) { return; } e.SuppressKeyPress = true; switch (e.KeyCode) { default: MessageBox.Show("Form.KeyPress: '" + e.KeyCode + "' consumed."); break; } }; // DirectX / FFMPEG setup _cancellationTokenSource = new CancellationTokenSource(); _audioRenderer = new DxAudio( (int)Program.AudioFormat.SampleRate, (int)Program.AudioFormat.Channels); _videoRenderer = new DxVideo( (int)Program.VideoFormat.Width, (int)Program.VideoFormat.Height); _decoder = new FFmpegDecoder(Program.Nano, Program.AudioFormat, Program.VideoFormat); Program.Nano.AudioFrameAvailable += _decoder.ConsumeAudioData; Program.Nano.VideoFrameAvailable += _decoder.ConsumeVideoData; if (Config.UseController) { _input = new DxInput($"{baseDir}/gamecontrollerdb.txt"); _handleInputEvent += _input.HandleInput; } Shown += (object sender, EventArgs e) => { _thread = new Thread(MainLoop); _thread.Start(); }; }
public void PlaySelectedItem(Media selectedItem) { VideoDisplay.SetSource(selectedItem.MediaPath); }
public Playlist(VideoDisplay videoDisplay) { this.VideoDisplay = videoDisplay; }
// Use this for initialization protected override void Start() { prefabName = "VIDEO"; base.Start(); videoDisplay = processable as VideoDisplay; }
private void SetupMediaStreamSource() { VideoDisplay.SetMediaStreamSource(_composition.GeneratePreviewMediaStreamSource((int)VideoDisplay.ActualWidth, (int)VideoDisplay.ActualHeight)); }
public void ShowSlide(bool showkey) { keydisplay = showkey; background.Visibility = Visibility.Hidden; if (showkey) { if (Slide.KeyBitmap != null) { VideoDisplay.Visibility = Visibility.Hidden; textDisplay.Visibility = Visibility.Hidden; ImgDisplay.Visibility = Visibility.Visible; ImgDisplay.Source = Slide.KeyBitmap.ConvertToBitmapImage(); } else { VideoDisplay.Visibility = Visibility.Hidden; textDisplay.Text = "NO KEY"; // handle action slides being auto loaded with black keys if (Slide.RenderedAs == "Action") { background.Fill = Brushes.Black; background.Visibility = Visibility.Visible; textDisplay.Text = "AUTO BLACK KEY\r\n(for action)"; } textDisplay.Visibility = Visibility.Visible; ImgDisplay.Visibility = Visibility.Hidden; } } else { ImgDisplay.Source = null; VideoDisplay.Source = null; if (Slide?.MediaType == MediaType.Image) { VideoDisplay.Visibility = Visibility.Hidden; textDisplay.Visibility = Visibility.Hidden; ImgDisplay.Visibility = Visibility.Visible; ImgDisplay.Source = Slide.Bitmap.ConvertToBitmapImage(); } if (Slide?.MediaType == MediaType.Video) { ImgDisplay.Visibility = Visibility.Hidden; textDisplay.Visibility = Visibility.Hidden; VideoDisplay.Visibility = Visibility.Visible; VideoDisplay.Source = new Uri(Slide.AssetPath); VideoDisplay.MediaEnded += VideoDisplay_MediaEnded; VideoDisplay.Volume = 0; VideoDisplay.Play(); } if (Slide?.MediaType == MediaType.Audio) { VideoDisplay.Visibility = Visibility.Hidden; textDisplay.Visibility = Visibility.Visible; ImgDisplay.Visibility = Visibility.Visible; ImgDisplay.Source = new BitmapImage(new Uri("pack://application:,,,/ViewControls/Images/musicnote.png")); textDisplay.Text = Slide.Name + Slide.CopyExtension; } if (Slide?.MediaType == MediaType.Text) { VideoDisplay.Visibility = Visibility.Hidden; ImgDisplay.Visibility = Visibility.Hidden; textDisplay.Visibility = Visibility.Visible; textDisplay.Text = Slide.Text; } } }
private void VideoDisplay_MediaEnded(object sender, RoutedEventArgs e) { VideoDisplay.Stop(); VideoDisplay.Volume = 0; VideoDisplay.Play(); }
public SessionWindow(String remotePartyUri) : base() { InitializeComponent(); this.remotePartyUri = remotePartyUri; this.Title = String.Empty; this.buttonCallOrAnswer.Tag = Strings.Text_Call; this.fileTransferSessions = new List <MyMsrpSession>(); this.imActivityIndicator = new IMActivityIndicator(this.remotePartyUri); this.videoDisplayLocal = new VideoDisplay(); this.videoDisplayLocal.VerticalAlignment = VerticalAlignment.Stretch; this.videoDisplayLocal.HorizontalAlignment = HorizontalAlignment.Stretch; this.videoDisplayScrenCastLocal = new VideoDisplay(); this.videoDisplayScrenCastLocal.VerticalAlignment = this.videoDisplayLocal.VerticalAlignment; this.videoDisplayScrenCastLocal.HorizontalAlignment = this.videoDisplayLocal.HorizontalAlignment; this.videoDisplayRemote = new VideoDisplay(); this.videoDisplayRemote.ToolTip = this.borderVideoDispalyRemote.ToolTip; this.borderVideoDispalyRemote.Child = this.videoDisplayRemote; this.borderVideoDispalyLocal.Child = this.videoDisplayLocal; this.borderVideoDispalyScrenCastLocal.Child = this.videoDisplayScrenCastLocal; this.labelInfo.Content = String.Empty; this.timerCall = new Timer(1000); this.timerCall.AutoReset = true; this.timerCall.Elapsed += this.timerCall_Elapsed; // QoS this.labelQuality.Content = String.Empty; this.timerQuality = new Timer(3000); this.timerQuality.AutoReset = true; this.timerQuality.Elapsed += this.timerQuality_Elapsed; // Services this.contactService = Win32ServiceManager.SharedManager.ContactService; this.sipService = Win32ServiceManager.SharedManager.SipService; this.historyService = Win32ServiceManager.SharedManager.HistoryService; this.soundService = Win32ServiceManager.SharedManager.SoundService; this.configurationService = Win32ServiceManager.SharedManager.ConfigurationService; // Messaging this.historyDataSource = new MyObservableCollection <HistoryEvent>(); this.historyCtrl.ItemTemplateSelector = new DataTemplateSelectorMessaging(); this.historyCtrl.ItemsSource = this.historyDataSource; // Register events this.sipService.onInviteEvent += this.sipService_onInviteEvent; this.imActivityIndicator.RemoteStateChangedEvent += this.imActivityIndicator_RemoteStateChangedEvent; this.imActivityIndicator.SendMessageEvent += this.imActivityIndicator_SendMessageEvent; this.volume = this.configurationService.Get(Configuration.ConfFolder.GENERAL, Configuration.ConfEntry.AUDIO_VOLUME, Configuration.DEFAULT_GENERAL_AUDIO_VOLUME); this.sliderVolume.Value = (double)this.volume; lock (SessionWindow.windows) { SessionWindow.windows.Add(this); } }