public VlcMediaPlayer(VlcInstance instance, VlcMedia media)
 {
     this._instance = instance;
     this._media = media;
     Handle = VLCLibrary.Instance.media_player_new_from_media(media.Handle);
     if (Handle == IntPtr.Zero) throw new VlcException();
 }
        public VlcMediaPlayer CreatePlayer(string mediaPath)
        {
            if (!System.IO.File.Exists(mediaPath))
                return null;

            VlcMedia media;
            try
            {
                System.IO.FileAttributes attr = System.IO.File.GetAttributes(System.IO.Path.GetFullPath(mediaPath));
                if ((attr & System.IO.FileAttributes.Directory) == System.IO.FileAttributes.Directory)
                {
                    media = new VlcMedia(this, @"dvd://" + mediaPath);
                }
                else
                {
                    media = new VlcMedia(this, mediaPath);
                }
            }
            catch (Exception e)
            {
                media = new VlcMedia(this, mediaPath);
            }

            VlcMediaPlayer player = new VlcMediaPlayer(this, media);
            if (player != null) {
                _player = player;
            }

            return player;
        }
 public VlcMediaPlayer(VlcInstance instance, VlcMedia media)
 {
     this._instance = instance;
     this._media    = media;
     Handle         = VLCLibrary.Instance.media_player_new_from_media(media.Handle);
     if (Handle == IntPtr.Zero)
     {
         throw new VlcException();
     }
 }
        public VlcMediaPlayer CreatePlayer(string mediaPath)
        {
            if (!System.IO.File.Exists(mediaPath))
            {
                return(null);
            }

            VlcMedia media;

            try
            {
                System.IO.FileAttributes attr = System.IO.File.GetAttributes(System.IO.Path.GetFullPath(mediaPath));
                if ((attr & System.IO.FileAttributes.Directory) == System.IO.FileAttributes.Directory)
                {
                    media = new VlcMedia(this, @"dvd://" + mediaPath);
                }
                else
                {
                    media = new VlcMedia(this, mediaPath);
                }
            }
            catch (Exception e)
            {
                media = new VlcMedia(this, mediaPath);
            }


            VlcMediaPlayer player = new VlcMediaPlayer(this, media);

            if (player != null)
            {
                _player = player;
            }

            return(player);
        }