[Android] Add a VideoView Skeleton
Jean-Baptiste Kempf
git at videolan.org
Sun May 24 18:47:24 CEST 2015
vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun May 24 17:36:54 2015 +0200| [589666ea884c350ae1d656691d2980c968a26449] | committer: Jean-Baptiste Kempf
Add a VideoView Skeleton
This is mimicking android.media.videoview and the skeleton was done
based on the public JavaDoc
It is currently useless
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=589666ea884c350ae1d656691d2980c968a26449
---
.../src/org/videolan/libvlc/media/VideoView.java | 215 ++++++++++++++++++++
1 file changed, 215 insertions(+)
diff --git a/libvlc/src/org/videolan/libvlc/media/VideoView.java b/libvlc/src/org/videolan/libvlc/media/VideoView.java
new file mode 100644
index 0000000..0818922
--- /dev/null
+++ b/libvlc/src/org/videolan/libvlc/media/VideoView.java
@@ -0,0 +1,215 @@
+/*****************************************************************************
+ * VideoView.java
+ *****************************************************************************
+ * Copyright © 2015 VLC authors and VideoLAN
+ *
+ * Authors Jean-Baptiste Kempf <jb at videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+package org.videolan.libvlc.media;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.media.MediaFormat;
+import android.media.MediaPlayer.OnCompletionListener;
+import android.media.MediaPlayer.OnErrorListener;
+import android.media.MediaPlayer.OnInfoListener;
+import android.media.MediaPlayer.OnPreparedListener;
+
+import android.net.Uri;
+import android.os.Build;
+import android.util.AttributeSet;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+import android.view.SurfaceView;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.widget.MediaController;
+
+
+import java.io.InputStream;
+import java.util.Map;
+
+public class VideoView extends SurfaceView
+ implements MediaController.MediaPlayerControl {
+
+ public VideoView(Context context) {
+ super(context);
+ }
+
+ public VideoView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public VideoView(Context context, AttributeSet attrs, int defStyleAttr) {
+ this(context, attrs, defStyleAttr, 0);
+ }
+
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ public VideoView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ @Override
+ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
+ super.onInitializeAccessibilityEvent(event);
+ }
+
+ @Override
+ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
+ super.onInitializeAccessibilityNodeInfo(info);
+ }
+
+ public int resolveAdjustedSize(int desiredSize, int measureSpec) {
+ return getDefaultSize(desiredSize, measureSpec);
+ }
+
+ public void setVideoPath(String path) {
+ }
+
+ public void setVideoURI(Uri uri) {
+ }
+
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ public void setVideoURI(Uri uri, Map<String, String> headers) {
+ }
+
+ public void addSubtitleSource(InputStream is, MediaFormat format) {
+ }
+
+ public void setMediaController(MediaController controller) {
+ }
+
+ public void setOnPreparedListener(OnPreparedListener l) {
+ }
+
+ public void setOnCompletionListener(OnCompletionListener l) {
+ }
+
+ public void setOnErrorListener(OnErrorListener l) {
+ }
+
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
+ public void setOnInfoListener(OnInfoListener l) {
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent ev) {
+ return super.onTouchEvent(ev);
+ }
+
+ @Override
+ public boolean onTrackballEvent(MotionEvent ev) {
+ return super.onTrackballEvent(ev);
+ }
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ return super.onKeyDown(keyCode, event);
+ }
+
+ @Override
+ public void start() {
+ }
+
+ @Override
+ public void pause() {
+ }
+
+ public void stopPlayback() {
+ }
+
+ @TargetApi(Build.VERSION_CODES.FROYO)
+ public void suspend() {
+ }
+
+ public void resume() {
+ }
+
+ @Override
+ public int getDuration() {
+ return -1;
+ }
+
+ @Override
+ public int getCurrentPosition() {
+ return 0;
+ }
+
+ @Override
+ public void seekTo(int msec) {
+ }
+
+ @Override
+ public boolean isPlaying() {
+ return false;
+ }
+
+ @Override
+ public int getBufferPercentage() {
+ return 0;
+ }
+
+ @Override
+ public boolean canPause() {
+ return false;
+ }
+
+ @Override
+ public boolean canSeekBackward() {
+ return false;
+ }
+
+ @Override
+ public boolean canSeekForward() {
+ return false;
+ }
+
+ @Override
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
+ public int getAudioSessionId() {
+ return 0;
+ }
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ super.draw(canvas);
+ }
+
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ super.onLayout(changed, left, top, right, bottom);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+}
More information about the Android
mailing list