[Android] [PATCH 5/5] Added method to get the player state.

Paulo Vitor Magacho da Silva pvmagacho at gmail.com
Fri Jul 25 04:14:33 CEST 2014


---
 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 1f11b20..ec1a28b 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -503,6 +503,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 abc50a7..0dbc1f5 100644
--- a/vlc-android/src/org/videolan/libvlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/libvlc/LibVLC.java
@@ -565,6 +565,11 @@ public class LibVLC {
     public native void stop();
 
     /**
+     * Get player state.
+     */
+    public native int getPlayerState();
+
+    /**
      * Gets volume as integer
      */
     public native int getVolume();
-- 
1.8.5.2 (Apple Git-48)



More information about the Android mailing list