public override bool Play(string strFile) { url = strFile; VlcContext.StartupOptions.IgnoreConfig = true; VlcContext.StartupOptions.AddOption("--no-video-title-show"); VlcContext.StartupOptions.AddOption("--http-caching=" + OnlineVideos.MediaPortal1.PluginConfiguration.Instance.wmpbuffer); //VlcContext.StartupOptions.LogOptions.LogInFile = true; //VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.Standard; //VlcContext.StartupOptions.LogOptions.LogInFilePath = Path.Combine(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Log), "vlc-onlinevideos.log"); if (IsInstalled) { VlcContext.LibVlcDllsPath = vlcPath; VlcContext.LibVlcPluginsPath = Path.Combine(vlcPath, "plugins"); } vlcCtrl = new VlcControl(); GUIGraphicsContext.form.Controls.Add(vlcCtrl); vlcCtrl.Enabled = false; vlcCtrl.PositionChanged += vlcCtrl_PositionChanged; vlcCtrl.EncounteredError += vlcCtrl_EncounteredError; media = new PathMedia(strFile); vlcCtrl.Play(media); GUIPropertyManager.SetProperty("#TV.Record.percent3", 0.0f.ToString()); // set to 0, as this player doesn't support download progress reporting GUIWaitCursor.Init(); GUIWaitCursor.Show(); // init and show the wait cursor while buffering return(true); }
public void Preview() { if (!string.IsNullOrEmpty(this.File)) { MediaBase media = new PathMedia(File); media.ParsedChanged += media_ParsedChanged; myVlcControl.AudioProperties.IsMute = true; myVlcControl.AudioProperties.Volume = 0; myVlcControl.Media = media; myVlcControl.Play(); } }
private void PlayMedia(Code.Media.MediaData m) { if (m.LocalFile != null) { PathMedia media = new PathMedia(m.LocalFile.FullName); media.ParsedChanged += MediaOnParsedChanged; myVlcControl.Media = media; myVlcControl.Position = this.Position; } else { LocationMedia media = m.LocationMedia; media.ParsedChanged += MediaOnParsedChanged; myVlcControl.Media = media; } myVlcControl.Play(); }
/// <summary> /// Initializes a new instance of the <see cref="VlcPlayer"/> class. /// </summary> /// <remarks> /// Making changes to the Form sometimes adds the following line of code to VlcPlayer.Designer.cs: /// this.vlcControl.Media = null; /// As the Media property may not be set to null in the current release, this will raise an exception at /// runtime. So, if you get an <see cref="ArgumentNullException"/> in VlcControl.Common.cs, check for this /// line of code and remove it. /// </remarks> public VlcPlayer() { InitializeComponent(); labelPlaybackPosition.Text = string.Empty; this.vlcControl.PositionChanged += this.VlcControlOnPositionChanged; /* * var media = new LocationMedia("screen://"); * vlcControl1.SetMedia(media); */ if (openFileDialog.ShowDialog(this) == DialogResult.OK) { var media = new PathMedia(openFileDialog.FileName); vlcControl.Media = media; } }
private void cbxVideo_SelectionChanged(object sender, SelectionChangedEventArgs e) { string fileName = cbxVideo.SelectedValue.ToString(); if (fileName.Equals(Common.VIDEO_NONE)) { vlcPlayer.VideoSource = null; imgPreview.Source = null; } else { //check video if (Common.VIDEO_EXTS.Contains(System.IO.Path.GetExtension(fileName).ToLower())) { imgPreview.Source = null; try { PathMedia sr = new PathMedia(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, Common.VIDEO_DIR, fileName)); vlcPlayer.Media = sr; } catch (Exception ex) { MessageBox.Show("Cannot open video file. Please try again later!\n\n" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } else //image { vlcPlayer.VideoSource = null; imgPreview.Source = new BitmapImage(new Uri(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, Common.IMAGE_DIR, fileName))); } } if (!(bool)tgbtnControlLockVideo.IsChecked) { SaveChangeEnable(); } }