private void initializeFactory(string[] vlcParameters) { if (vlcParameters == null) { vlcParameters = new string[] { }; } mediaLibraryFactory = new VlcMediaLibraryFactory(vlcParameters); }
private void testPlayerState(MediaLibraryFactory factory) { PlayerOutput nullOutput = new PlayerOutput(); // string path = GetSampleAudioPath(); if (!System.IO.File.Exists(path)) { Assert.Ignore("The sample file doesn't exists. Ignoring."); } MediaInput input = new MediaInput(MediaInputType.File, path); // using (Player player = factory.CreatePlayer(nullOutput)) { testPlayerState(player, input); } }
/// <summary> /// Initialization of vlclib resources being used by control. /// <see cref="InvalidOperationException"/> will be thrown on re-initialization. /// <see cref="MediaPlayerException"/> may be thrown during initialization VLC subsystem. /// </summary> public void Initialize() { if (isInitialized) { throw new InvalidOperationException("This object does not support multi time initialization."); } // isInitialized = true; // Install VLC packages if necessary VlcDeployment deployment = VlcDeployment.Default; if (!deployment.CheckVlcLibraryExistence(true, false)) { if (logger.IsInfoEnabled) { logger.Info("Unable to find installed vlc library. Starting installing from zip archive."); } deployment.Install(false, true, false, false); if (logger.IsInfoEnabled) { logger.Info("Installed."); } } // VLC objects initialization mediaLibraryFactory = new VlcMediaLibraryFactory(new string[] { "--no-snapshot-preview", "--ignore-config", "--no-osd", "--plugin-path", Path.Combine(getStartupPath(), "plugins") }); player = mediaLibraryFactory.CreatePlayer(new PlayerOutput(vlcWindowControl.Window)); // Subscribe to events VlcPlayerEventsReceiver receiver = new VlcPlayerEventsReceiver(); receiver.EndReached += endReachedEventHandler; receiver.PositionChanged += positionChangedEventHandler; player.EventsReceivers.Add(receiver); }