[Android] TV: Util method to load a media

Geoffrey Métais git at videolan.org
Thu Jun 2 15:13:02 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jun  2 15:12:02 2016 +0200| [0ce2ba81c19a9383502cdca215ce3d04c66fc292] | committer: Geoffrey Métais

TV: Util method to load a media

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

 vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.java | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.java b/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.java
index 4c482dc..d1f78f7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.java
@@ -44,6 +44,17 @@ public class TvUtil {
         content.setPadding(hm, vm, hm, vm);
     }
 
+    public static void playMedia(Activity activity, MediaWrapper media){
+        if (media.getType() == MediaWrapper.TYPE_AUDIO) {
+            ArrayList<MediaWrapper> tracks = new ArrayList<>();
+            tracks.add(media);
+            Intent intent = new Intent(activity, AudioPlayerActivity.class);
+            intent.putExtra(AudioPlayerActivity.MEDIA_LIST, tracks);
+            activity.startActivity(intent);
+        } else
+            MediaUtils.openMedia(activity, media);
+    }
+
     public static void openMedia(Activity activity, Object item , Row row){
         if (item instanceof MediaWrapper) {
             MediaWrapper mediaWrapper = (MediaWrapper) item;



More information about the Android mailing list