public void Initialize(ILogger logger, Func <IVideoHost> getHost)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            if (getHost == null)
            {
                throw new ArgumentNullException("getHost");
            }

            this.logger  = logger;
            this.getHost = getHost;

            panel           = new System.Windows.Forms.Panel();
            panel.BackColor = System.Drawing.Color.Black;
            formHost.Child  = panel;

            playerFactory = new MediaPlayerFactory(logger);
            player        = playerFactory.CreatePlayer <IVlcVideoPlayer>();

            this.DataContext = player;

            player.Events.PlayerPositionChanged += new EventHandler <MediaPlayerPositionChanged>(Events_PlayerPositionChanged);
            player.Events.TimeChanged           += new EventHandler <MediaPlayerTimeChanged>(Events_TimeChanged);
            player.Events.MediaEnded            += new EventHandler(Events_MediaEnded);
            player.Events.PlayerStopped         += new EventHandler(Events_PlayerStopped);

            player.WindowHandle = panel.Handle;
            volumeSlider.Value  = player.Volume;
        }
Ejemplo n.º 2
0
        public MediaListPlayer(IntPtr hMediaLib, IMediaList mediaList)
        {
            m_mediaList        = mediaList;
            m_hMediaListPlayer = LibVlcMethods.libvlc_media_list_player_new(hMediaLib);
            LibVlcMethods.libvlc_media_list_player_set_media_list(m_hMediaListPlayer, ((INativePointer)m_mediaList).Pointer);
            m_mediaList.Dispose();

            m_videoPlayer = new VideoPlayer(hMediaLib);
            LibVlcMethods.libvlc_media_list_player_set_media_player(m_hMediaListPlayer, ((INativePointer)m_videoPlayer).Pointer);
            m_videoPlayer.Dispose();
        }
Ejemplo n.º 3
0
      public MediaListPlayer(IntPtr hMediaLib, IMediaList mediaList)
      {
         m_mediaList = mediaList;
         m_hMediaListPlayer = LibVlcMethods.libvlc_media_list_player_new(hMediaLib);
         LibVlcMethods.libvlc_media_list_player_set_media_list(m_hMediaListPlayer, ((INativePointer)m_mediaList).Pointer);
         m_mediaList.Dispose();

         m_videoPlayer = new VideoPlayer(hMediaLib);
         LibVlcMethods.libvlc_media_list_player_set_media_player(m_hMediaListPlayer, ((INativePointer)m_videoPlayer).Pointer);
         m_videoPlayer.Dispose();
      }
        public void Initialize(ILogger logger, Func<IVideoHost> getHost)
        {
            if (logger == null)
                throw new ArgumentNullException("logger");
            if (getHost == null)
                throw new ArgumentNullException("getHost");

            this.logger = logger;
            this.getHost = getHost;

            panel = new System.Windows.Forms.Panel();
            panel.BackColor = System.Drawing.Color.Black;
            formHost.Child = panel;

            playerFactory = new MediaPlayerFactory(logger);
            player = playerFactory.CreatePlayer<IVlcVideoPlayer>();

            this.DataContext = player;

            player.Events.PlayerPositionChanged += new EventHandler<MediaPlayerPositionChanged>(Events_PlayerPositionChanged);
            player.Events.TimeChanged += new EventHandler<MediaPlayerTimeChanged>(Events_TimeChanged);
            player.Events.MediaEnded += new EventHandler(Events_MediaEnded);
            player.Events.PlayerStopped += new EventHandler(Events_PlayerStopped);

            player.WindowHandle = panel.Handle;
            volumeSlider.Value = player.Volume;
        }