]> git.sesse.net Git - vlc/blobdiff - bindings/cil/src/media.cs
Add media and player state support
[vlc] / bindings / cil / src / media.cs
index 18d6b784b59ee2e9756c0cd0b78170d2771fd519..5c3b0cf24a5d4c2ef666b32624a8ed59b054b737 100644 (file)
@@ -42,6 +42,24 @@ namespace VideoLAN.LibVLC
         }
     };
 
+    /**
+     * @brief State: media/player state
+     *
+     * Media and Player objects are always in one of these state.
+     * @see Media::State and @see Player::State.
+     */
+    public enum State
+    {
+        NothingSpecial, /**< Nothing going on */
+        Opening, /**< Being opened */
+        Buffering, /**< Buffering before play */
+        Playing, /**< Playing */
+        Paused, /**< Paused */
+        Stopped, /**< Stopped */
+        Ended, /**< Played until the end */
+        Error, /**< Failed */
+    };
+
     /**
      * @brief Media: a source media
      * @ingroup API
@@ -102,7 +120,7 @@ namespace VideoLAN.LibVLC
         {
             get
             {
-                MemoryHandle str = LibVLC.MediaGetMRL (Handle, ex);
+                StringHandle str = LibVLC.MediaGetMRL (Handle, ex);
                 Raise ();
                 return str.Transform ();
             }
@@ -121,10 +139,23 @@ namespace VideoLAN.LibVLC
             return new Media (LibVLC.MediaDuplicate (Handle));
         }
 
+        /**
+         * Current state of the media.
+         */
+        public State State
+        {
+            get
+            {
+                State ret = LibVLC.MediaGetState (Handle, ex);
+                Raise ();
+                return ret;
+            }
+        }
+
         /**
          * Duration of the media in microseconds. The precision of the result
          * depends on the input stram protocol and file format. The value
-         * might be incorrect and unknown (VLC usually returns 0 then).
+         * might be incorrect and unknown (VLC usually returns 0 or -1 then).
          */
         public long Duration
         {