[Android] VideoView: first implementations

Jean-Baptiste Kempf git at videolan.org
Wed May 27 12:37:57 CEST 2015


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue May 26 13:52:52 2015 +0200| [e71391475bd0e63f92c9347216d0bc735352523b] | committer: Jean-Baptiste Kempf

VideoView: first implementations

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

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

diff --git a/libvlc/src/org/videolan/libvlc/media/VideoView.java b/libvlc/src/org/videolan/libvlc/media/VideoView.java
index 0818922..e3054ab 100644
--- a/libvlc/src/org/videolan/libvlc/media/VideoView.java
+++ b/libvlc/src/org/videolan/libvlc/media/VideoView.java
@@ -42,12 +42,17 @@ import android.view.accessibility.AccessibilityNodeInfo;
 import android.widget.MediaController;
 
 
+import org.videolan.libvlc.LibVLC;
+import org.videolan.libvlc.Media;
+
 import java.io.InputStream;
 import java.util.Map;
 
 public class VideoView extends SurfaceView
         implements MediaController.MediaPlayerControl {
 
+    private static LibVLC sLibVLC;
+
     public VideoView(Context context) {
         super(context);
     }
@@ -65,6 +70,10 @@ public class VideoView extends SurfaceView
         super(context, attrs, defStyleAttr, defStyleRes);
     }
 
+    private void initLibVLC() {
+        sLibVLC = new LibVLC();
+    }
+
     @Override
     @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
     public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
@@ -82,16 +91,22 @@ public class VideoView extends SurfaceView
     }
 
     public void setVideoPath(String path) {
+        initLibVLC();
+        final Media media = new Media(sLibVLC, path);
     }
 
     public void setVideoURI(Uri uri) {
+        initLibVLC();
+        final Media media = new Media(sLibVLC, uri);
     }
 
     @TargetApi(Build.VERSION_CODES.LOLLIPOP)
     public void setVideoURI(Uri uri, Map<String, String> headers) {
+        setVideoURI(uri);
     }
 
     public void addSubtitleSource(InputStream is, MediaFormat format) {
+
     }
 
     public void setMediaController(MediaController controller) {



More information about the Android mailing list