[Android] LibVLC: MediaPlayer: add getCurrentVideoTrack

Thomas Guillem git at videolan.org
Mon Nov 28 16:39:12 CET 2016


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Nov 24 16:52:06 2016 +0100| [caf9cc03e91854a3430a0c1ab7cc79eccb3e3d34] | committer: Thomas Guillem

LibVLC: MediaPlayer: add getCurrentVideoTrack

> https://code.videolan.org/videolan/vlc-android/commit/caf9cc03e91854a3430a0c1ab7cc79eccb3e3d34
---

 libvlc/src/org/videolan/libvlc/MediaPlayer.java | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index ed26fb5..d3bde71 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -634,6 +634,21 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
     }
 
     /**
+     * Get the current video track
+     */
+    public Media.VideoTrack getCurrentVideoTrack() {
+        if (getVideoTrack() == -1)
+            return null;
+        final int trackCount = mMedia.getTrackCount();
+        for (int i = 0; i < trackCount; ++i) {
+            final Media.Track  track = mMedia.getTrack(i);
+            if (track.type == Media.Track.Type.Video)
+                return (Media.VideoTrack) track;
+        }
+        return null;
+    }
+
+    /**
      * Get the number of available audio tracks.
      */
     public int getAudioTracksCount() {



More information about the Android mailing list