Java Code Examples for com.google.android.gms.cast.MediaMetadata#getImages()
The following examples show how to use
com.google.android.gms.cast.MediaMetadata#getImages() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CastOptionsProvider.java From CastVideos-android with Apache License 2.0 | 6 votes |
@Override public WebImage onPickImage(MediaMetadata mediaMetadata, int type) { if ((mediaMetadata == null) || !mediaMetadata.hasImages()) { return null; } List<WebImage> images = mediaMetadata.getImages(); if (images.size() == 1) { return images.get(0); } else { if (type == ImagePicker.IMAGE_TYPE_MEDIA_ROUTE_CONTROLLER_DIALOG_BACKGROUND) { return images.get(0); } else { return images.get(1); } } }
Example 2
Source File: GoogleCastOptionsProvider.java From react-native-google-cast with MIT License | 6 votes |
@Override public WebImage onPickImage(MediaMetadata mediaMetadata, int type) { if ((mediaMetadata == null) || !mediaMetadata.hasImages()) { return null; } List<WebImage> images = mediaMetadata.getImages(); if (images.size() == 1) { return images.get(0); } else { if (type == ImagePicker.IMAGE_TYPE_MEDIA_ROUTE_CONTROLLER_DIALOG_BACKGROUND) { return images.get(0); } else { return images.get(1); } } }
Example 3
Source File: CastOptionsProvider.java From DeviceConnect-Android with MIT License | 6 votes |
@Override public WebImage onPickImage(MediaMetadata mediaMetadata, int type) { if ((mediaMetadata == null) || !mediaMetadata.hasImages()) { return null; } List<WebImage> images = mediaMetadata.getImages(); if (images.size() == 1) { return images.get(0); } else { if (type == ImagePicker.IMAGE_TYPE_MEDIA_ROUTE_CONTROLLER_DIALOG_BACKGROUND) { return images.get(0); } else { return images.get(1); } } }
Example 4
Source File: CastUtils.java From UTubeTV with The Unlicense | 6 votes |
/** * Builds and returns a {@link Bundle} which contains a select subset of data in the * {@link MediaInfo}. Since {@link MediaInfo} is not {@link Parcelable}, one can use this * container bundle to pass around from one activity to another. */ public static Bundle fromMediaInfo(MediaInfo info) { if (null == info) { return null; } MediaMetadata md = info.getMetadata(); Bundle wrapper = new Bundle(); wrapper.putString(MediaMetadata.KEY_TITLE, md.getString(MediaMetadata.KEY_TITLE)); wrapper.putString(MediaMetadata.KEY_SUBTITLE, md.getString(MediaMetadata.KEY_SUBTITLE)); wrapper.putString(KEY_URL, info.getContentId()); wrapper.putString(MediaMetadata.KEY_STUDIO, md.getString(MediaMetadata.KEY_STUDIO)); wrapper.putString(KEY_CONTENT_TYPE, info.getContentType()); wrapper.putInt(KEY_STREAM_TYPE, info.getStreamType()); if (null != md.getImages()) { ArrayList<String> urls = new ArrayList<String>(); for (WebImage img : md.getImages()) { urls.add(img.getUrl().toString()); } wrapper.putStringArrayList(KEY_IMAGES, urls); } return wrapper; }
Example 5
Source File: Utils.java From android with Apache License 2.0 | 5 votes |
/** * Builds and returns a {@link Bundle} which contains a select subset of data in the * {@link MediaInfo}. Since {@link MediaInfo} is not {@link Parcelable}, one can use this * container bundle to pass around from one activity to another. * * @param info * @return * @see <code>toMediaInfo()</code> */ public static Bundle fromMediaInfo(MediaInfo info) { if (null == info) { return null; } MediaMetadata md = info.getMetadata(); Bundle wrapper = new Bundle(); wrapper.putString(MediaMetadata.KEY_TITLE, md.getString(MediaMetadata.KEY_TITLE)); wrapper.putString(MediaMetadata.KEY_SUBTITLE, md.getString(MediaMetadata.KEY_SUBTITLE)); wrapper.putString(KEY_URL, info.getContentId()); wrapper.putString(MediaMetadata.KEY_STUDIO, md.getString(MediaMetadata.KEY_STUDIO)); wrapper.putString(KEY_CONTENT_TYPE, info.getContentType()); wrapper.putInt(KEY_STREAM_TYPE, info.getStreamType()); if (!md.getImages().isEmpty()) { ArrayList<String> urls = new ArrayList<String>(); for (WebImage img : md.getImages()) { urls.add(img.getUrl().toString()); } wrapper.putStringArrayList(KEY_IMAGES, urls); } JSONObject customData = info.getCustomData(); if (null != customData) { wrapper.putString(KEY_CUSTOM_DATA, customData.toString()); } return wrapper; }
Example 6
Source File: CastUtils.java From UTubeTV with The Unlicense | 5 votes |
/** * Returns the URL of an image for the MediaInformation at the given level. Level should * be a number between 0 and <code>n - 1</code> where <code>n * </code> is the number of images for that given item. */ public static String getImageUrl(MediaInfo info, int level) { MediaMetadata mm = info.getMetadata(); if (null != mm && null != mm.getImages() && mm.getImages().size() > level) { return mm.getImages().get(level).getUrl().toString(); } return null; }