コード例 #1
0
        private void TryToCreateClient()
        {
            if (myHandle == IntPtr.Zero)
            {
                return;
            }

            string path = string.IsNullOrEmpty(myVlcLibPath) ? AppDomain.CurrentDomain.BaseDirectory : myVlcLibPath;

            if (!File.Exists(Path.Combine(path, "libvlc.dll")) || !File.Exists(Path.Combine(path, "libvlccore.dll")))
            {
                return;
            }
            myClient              = new VideoLanClient(path);
            myClient.PluginPath   = Path.Combine(path, "plugins");
            myPlayer              = myClient.CreateMediaPlayer(myHandle);
            myPlayer.Audio.Volume = Volume;
            myPlayer.Audio.Mute   = Mute;
            //todo
            //myPlayer.PositionChanged +=
            //    delegate(object sender, VlcPositionChangedEventArgs e)
            //    {
            //        Position = e.Position;
            //    };
            myPlayer.StateChanged +=
                delegate(object sender, VlcStateChangedEventArgs e)
            {
                if (e.NewState == VlcState.Ended)
                {
                    Position = 0;
                }
            };
        }
コード例 #2
0
ファイル: VlcControl.cs プロジェクト: hcavazin/Vlc.DotNet
 protected override void Dispose(bool disposing)
 {
     if (myVlcMediaPlayer != null)
     {
         UnregisterEvents();
         if (IsPlaying)
             Stop();
         myVlcMediaPlayer.Dispose();
         myVlcMediaPlayer = null;
         base.Dispose(disposing);
         GC.SuppressFinalize(this);
     }
 }
コード例 #3
0
ファイル: VlcMedia.cs プロジェクト: zeroyou/Vlc.DotNet
        internal VlcMedia(VlcMediaPlayer player, FileInfo file, params string[] options)
#if NET20
            : this(player, VlcMediaInstanceExtensions.AddOptionToMedia(player.Manager.CreateNewMediaFromPath(file.FullName), player.Manager, options))
#else
            : this(player, player.Manager.CreateNewMediaFromPath(file.FullName).AddOptionToMedia(player.Manager, options))
コード例 #4
0
ファイル: VlcControl.cs プロジェクト: guxialv/Vlc.DotNet
 protected override void Dispose(bool disposing)
 {
     if (!disposed)
     {
         if (disposing)
         {
             if (myVlcMediaPlayer != null)
             {
                 UnregisterEvents();
                 if (IsPlaying)
                     Stop();
                 myVlcMediaPlayer.Dispose();
             }
             myVlcMediaPlayer = null;
             base.Dispose(disposing);
         }
         disposed = true;
     }
 }
コード例 #5
0
ファイル: VlcMedia.cs プロジェクト: Onemann/Vlc.DotNet
        internal VlcMedia(VlcMediaPlayer player, FileInfo file, params string[] options)
#if NET20
            : this(player, VlcMediaInstanceExtensions.AddOptionToMedia(player.Manager.CreateNewMediaFromPath(file.FullName), player.Manager, options))
#else
            : this(player, player.Manager.CreateNewMediaFromPath(file.FullName).AddOptionToMedia(player.Manager, options))
コード例 #6
0
 internal VlcMedia(VlcMediaPlayer player, VlcMediaInstance mediaInstance)
 {
     MediaInstance    = mediaInstance;
     myVlcMediaPlayer = player;
 }
コード例 #7
0
 internal VlcMedia(VlcMediaPlayer player, Stream stream, params string[] options)
     : this(player, player.Manager.CreateNewMediaFromStream(stream).AddOptionToMedia(player.Manager, options))
 {
 }
コード例 #8
0
 internal VlcMedia(VlcMediaPlayer player, string mrl, params string[] options)
     : this(player, player.Manager.CreateNewMediaFromLocation(mrl).AddOptionToMedia(player.Manager, options))
 {
 }
コード例 #9
0
 internal VlcMedia(VlcMediaPlayer player, Uri uri, params string[] options)
     : this(player, player.Manager.CreateNewMediaFromLocation(uri.AbsoluteUri).AddOptionToMedia(player.Manager, options))
 {
 }
コード例 #10
0
 internal VlcMedia(VlcMediaPlayer player, FileInfo file, params string[] options)
     : this(player, player.Manager.CreateNewMediaFromPath(file.FullName).AddOptionToMedia(player.Manager, options))
 {
 }
コード例 #11
-1
ファイル: VlcControl.cs プロジェクト: hcavazin/Vlc.DotNet
 public void EndInit()
 {
     if (IsInDesignMode() || myVlcMediaPlayer != null)
         return;
     if (VlcLibDirectory == null && (VlcLibDirectory = OnVlcLibDirectoryNeeded()) == null)
     {
         throw new Exception("'VlcLibDirectory' must be set.");
     }
     myVlcMediaPlayer = new VlcMediaPlayer(VlcLibDirectory);
     myVlcMediaPlayer.VideoHostControlHandle = Handle;
     RegisterEvents();
 }