Esempio n. 1
0
        //==========================================================================
        public void RunTest()
        {
            // The original tutorial code can be found at
            // http://wiki.videolan.org/LibVLC_Tutorial#Sample_LibVLC_Code

            LibVLCLibrary library = LibVLCLibrary.Load(null);

            try
            {
                IntPtr inst, mp, m;

                /* Load the VLC engine */
                inst = library.libvlc_new();

                /* Create a new item */
                //m = library.libvlc_media_new_location(inst, null);
                m = library.libvlc_media_new_path(inst, "F:\\Dropbox\\Music\\days.flac");
                /* Create a media player playing environement */
                mp = library.libvlc_media_player_new_from_media(m);

                /* No need to keep the media now */
                library.libvlc_media_release(m);


                /* play the media_player */
                library.libvlc_media_player_play(mp);

                Thread.Sleep(15000); /* Let it play a bit */

                /* Stop playing */
                library.libvlc_media_player_stop(mp);

                /* Free the media_player */
                library.libvlc_media_player_release(mp);

                library.libvlc_release(inst);
            }
            finally
            {
                LibVLCLibrary.Free(library);
            }
        }
Esempio n. 2
0
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);

            ////Set libvlc.dll and libvlccore.dll directory path
            //VlcContext.LibVlcDllsPath = CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_AMD64;
            ////Set the vlc plugins directory path
            //VlcContext.LibVlcPluginsPath = CommonStrings.PLUGINS_PATH_DEFAULT_VALUE_AMD64;

            ////Set the startup options
            //VlcContext.StartupOptions.IgnoreConfig = true;
            //VlcContext.StartupOptions.LogOptions.LogInFile = true;
            //VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = true;
            //VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.Debug;

            ////Initialize the VlcContext
            //VlcContext.Initialize();

            //Application.Run(new Form1());

            ////Close the VlcContext
            //VlcContext.CloseAll();



            LibVLCLibrary library = LibVLCLibrary.Load(null);
            IntPtr        inst, mp, m;

            inst = library.libvlc_new();                                         // Load the VLC engine
            m    = library.libvlc_media_new_location(inst, "path/to/your/file"); // Create a new item
            mp   = library.libvlc_media_player_new_from_media(m);                // Create a media player playing environement
            library.libvlc_media_release(m);                                     // No need to keep the media now
            library.libvlc_media_player_play(mp);                                // play the media_player
            Thread.Sleep(10000);                                                 // Let it play a bit
            library.libvlc_media_player_stop(mp);                                // Stop playing
            library.libvlc_media_player_release(mp);                             // Free the media_player
            library.libvlc_release(inst);

            LibVLCLibrary.Free(library);
        }
Esempio n. 3
0
        public void Stop()
        {
            store.Remove(this);

            if (library == null)
            {
                return;
            }

            library.libvlc_media_player_stop(mp);                             // Stop playing
            library.libvlc_media_player_release(mp);                          // Free the media_player
            library.libvlc_release(inst);

            LibVLCLibrary.Free(library);

            library = null;

            if (imageIntPtr != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(imageIntPtr);
            }
        }