[Android] Handled MediaPlayerTimeChanged event.

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:31 2014 +0100| [c40d37aa10df7395017b264775d71b65ddf8b239] | committer: Jean-Baptiste Kempf

Handled MediaPlayerTimeChanged event.

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

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

 vlc-android/jni/libvlcjni.c                           |    5 +++++
 vlc-android/src/org/videolan/libvlc/EventHandler.java |    2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index 33ebfb0..dc045b0 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -146,6 +146,10 @@ static void vlc_event_callback(const libvlc_event_t *ev, void *data)
             jstring sData = (*env)->NewStringUTF(env, "data");
             (*env)->CallVoidMethod(env, bundle, putFloat, sData, ev->u.media_player_position_changed.new_position);
             (*env)->DeleteLocalRef(env, sData);
+    } else if (ev->type == libvlc_MediaPlayerTimeChanged) {
+        jstring sData = (*env)->NewStringUTF(env, "data");
+        (*env)->CallVoidMethod(env, bundle, putInt, sData, (int) ev->u.media_player_time_changed.new_time);
+        (*env)->DeleteLocalRef(env, sData);
     } else if(ev->type == libvlc_MediaPlayerVout) {
         /* For determining the vout/ES track change */
         jstring sData = (*env)->NewStringUTF(env, "data");
@@ -388,6 +392,7 @@ void Java_org_videolan_libvlc_LibVLC_playMRL(JNIEnv *env, jobject thiz, jlong in
         libvlc_MediaPlayerStopped,
         libvlc_MediaPlayerVout,
         libvlc_MediaPlayerPositionChanged,
+        libvlc_MediaPlayerTimeChanged,
         libvlc_MediaPlayerEncounteredError
     };
     for(int i = 0; i < (sizeof(mp_events) / sizeof(*mp_events)); i++)
diff --git a/vlc-android/src/org/videolan/libvlc/EventHandler.java b/vlc-android/src/org/videolan/libvlc/EventHandler.java
index 5c365a6..5a61fed 100644
--- a/vlc-android/src/org/videolan/libvlc/EventHandler.java
+++ b/vlc-android/src/org/videolan/libvlc/EventHandler.java
@@ -50,7 +50,7 @@ public class EventHandler {
     //public static final int MediaPlayerBackward             = 0x108;
     public static final int MediaPlayerEndReached             = 0x109;
     public static final int MediaPlayerEncounteredError       = 0x10a;
-    //public static final int MediaPlayerTimeChanged          = 0x10b;
+    public static final int MediaPlayerTimeChanged          = 0x10b;
     public static final int MediaPlayerPositionChanged        = 0x10c;
     //public static final int MediaPlayerSeekableChanged      = 0x10d;
     //public static final int MediaPlayerPausableChanged      = 0x10e;



More information about the Android mailing list