[Android] Added method to get the player state.

Paulo Vitor Magacho da Silva git at videolan.org
Fri Jul 25 23:40:13 CEST 2014


vlc-ports/android | branch: master | Paulo Vitor Magacho da Silva <pvmagacho at gmail.com> | Fri Jul 25 03:14:33 2014 +0100| [76d172ee9c5cd79388d289c7973370fdf857a3fa] | committer: Jean-Baptiste Kempf

Added method to get the player state.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=76d172ee9c5cd79388d289c7973370fdf857a3fa
---

 vlc-android/jni/libvlcjni.c                     |    8 ++++++++
 vlc-android/src/org/videolan/libvlc/LibVLC.java |    5 +++++
 2 files changed, 13 insertions(+)

diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index 2ebdecb..541b7d7 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -487,6 +487,14 @@ void Java_org_videolan_libvlc_LibVLC_stop(JNIEnv *env, jobject thiz)
         libvlc_media_player_stop(mp);
 }
 
+jint Java_org_videolan_libvlc_LibVLC_getPlayerState(JNIEnv *env, jobject thiz)
+{
+    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+    if (mp)
+        return (jint) libvlc_media_player_get_state(mp);
+    return -1;
+}
+
 jint Java_org_videolan_libvlc_LibVLC_getVolume(JNIEnv *env, jobject thiz)
 {
     libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
diff --git a/vlc-android/src/org/videolan/libvlc/LibVLC.java b/vlc-android/src/org/videolan/libvlc/LibVLC.java
index 91201d2..cf1dbb5 100644
--- a/vlc-android/src/org/videolan/libvlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/libvlc/LibVLC.java
@@ -559,6 +559,11 @@ public class LibVLC {
     public native void stop();
 
     /**
+     * Get player state.
+     */
+    public native int getPlayerState();
+
+    /**
      * Gets volume as integer
      */
     public native int getVolume();



More information about the Android mailing list