Exemple #1
0
        private static void Main_()
        {
            // deploy library:
            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.");
                    logger.Info("Fail reason was " + deployment.FailReason);
                }
                deployment.Install(true, true, false, false);
                if (logger.IsInfoEnabled)
                {
                    logger.Info("Installed.");
                }
            }
            //
            Application.ThreadException += ApplicationOnThreadException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
            //
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainWindow());
        }
Exemple #2
0
        static void Main(string[] args)
        {
            bool createdNew;
            var  mutex = new Mutex(true, "BlueTubeViewer", out createdNew);

            if (!createdNew)
            {
                KryptonMessageBox.Show("Another instance of BlueTube is  running.", Constants.AppTitle);
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            VlcDeployment deployment = VlcDeployment.Default;

            if (!deployment.CheckVlcLibraryExistence(true, false))
            {
                deployment.Install(true, true, false, false);
            }

            ServicePointManager.DefaultConnectionLimit  = int.MaxValue;
            ServicePointManager.MaxServicePoints        = int.MaxValue;
            ServicePointManager.MaxServicePointIdleTime = 0;

            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            try
            {
                Application.Run(new MainForm());
            }
            catch (Exception Exception) {
            }
        }
        public void SetUp()
        {
            VlcDeployment deployment = VlcDeployment.Default;

            if (!deployment.CheckVlcLibraryExistence(true, false))
            {
                deployment.Install(true, true, false, false);
            }
            Thread th = new Thread(RunMessagesLoop);

            th.Start();
        }
Exemple #4
0
        static void Main()
        {
            // deploy library:
            VlcDeployment deployment = VlcDeployment.Default;

            // install library if it doesn't exist
            if (!deployment.CheckVlcLibraryExistence(false, false))
            {
                // install library
                deployment.Install(true);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new ControlPanel());
        }
 private void initializePlayer()
 {
     // that code will initialize factory if it is not initialized
     if (factory == null)
     {
         // this part of code will try to deploy VLC if it is necessary.
         // main idea - unzip libraries to specific place.
         VlcDeployment deployment = VlcDeployment.Default;
         // install library if it doesn't exist
         // NOTE: first parameter tells to check hash of deployed files to be sure about vlc version without loading it.
         // since vlc library can be initialized only once it is important not to load it during check
         // but it is still possible to check vlc version using libvlc_get_version, so if you want - pass second parameter
         // as 'true'.
         if (!deployment.CheckVlcLibraryExistence(false, false))
         {
             // install library
             deployment.Install(true);
         }
         // this is path to plugins. very important part of initialization of vlc.
         string path = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "plugins");
         // we can use a lot of parameters there.
         // refer to vlc --help to learn more.
         factory = new VlcMediaLibraryFactory(new string[] { "--reset-config",
                                                             "--no-snapshot-preview",
                                                             "--aspect-ratio=16:9",
                                                             "--ignore-config",
                                                             "--intf", "rc",
                                                             "--no-osd",
                                                             "--plugin-path", path });
         // tell our factory to create new version of players
         // NOTE: if you change this to 'false' old version of implementation will be created
         // NOTE: old implementation remains for backward compatibility
         factory.CreateSinglePlayers = true;
         // we going to output to NSView instance:
         PlayerOutput output = new PlayerOutput(new VlcNativeMediaWindow(VideoView.NativePointer, VlcWindowType.NSObject));
         // we can save stream to a file:
         // output.Files.Add(new OutFile("filePath"));
         player = (VlcSinglePlayer)factory.CreatePlayer(output);
         // add event receiver to get known about player events
         player.EventsReceivers.Add(new EventReceiver(this));
     }
 }
Exemple #6
0
        /// <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);
        }