本文整理汇总了Java中com.google.android.gms.common.images.WebImage类的典型用法代码示例。如果您正苦于以下问题:Java WebImage类的具体用法?Java WebImage怎么用?Java WebImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WebImage类属于com.google.android.gms.common.images包,在下文中一共展示了WebImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMediaInfo
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
MediaInfo createMediaInfo() {
MediaMetadata mediaMetadata = new MediaMetadata(mediaType);
if (!TextUtils.isEmpty(title)) mediaMetadata.putString(MediaMetadata.KEY_TITLE, title);
if (!TextUtils.isEmpty(subtitle)) mediaMetadata.putString(MediaMetadata.KEY_SUBTITLE, subtitle);
for (String imageUrl : imageUrls) {
mediaMetadata.addImage(new WebImage(Uri.parse(imageUrl)));
}
return new MediaInfo.Builder(url)
.setStreamType(streamType)
.setContentType(contentType)
.setStreamDuration(streamDuration)
.setMetadata(mediaMetadata)
.build();
}
示例2: onPickImage
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
@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);
}
}
}
示例3: displayImage
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
@Override
public void displayImage(String url, String mimeType, String title,
String description, String iconSrc, LaunchListener listener) {
MediaMetadata mMediaMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_PHOTO);
mMediaMetadata.putString(MediaMetadata.KEY_TITLE, title);
mMediaMetadata.putString(MediaMetadata.KEY_SUBTITLE, description);
if (iconSrc != null) {
Uri iconUri = Uri.parse(iconSrc);
WebImage image = new WebImage(iconUri, 100, 100);
mMediaMetadata.addImage(image);
}
com.google.android.gms.cast.MediaInfo mediaInformation = new com.google.android.gms.cast.MediaInfo.Builder(url)
.setContentType(mimeType)
.setStreamType(com.google.android.gms.cast.MediaInfo.STREAM_TYPE_NONE)
.setMetadata(mMediaMetadata)
.setStreamDuration(0)
.setCustomData(null)
.build();
playMedia(mediaInformation, applicationID, listener);
}
示例4: buildMediaInfo
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
private static MediaInfo buildMediaInfo(String title, String studio, String subTitle,
int duration, String url, String mimeType, String imgUrl, String bigImageUrl,
List<MediaTrack> tracks) {
MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, studio);
movieMetadata.putString(MediaMetadata.KEY_TITLE, title);
movieMetadata.addImage(new WebImage(Uri.parse(imgUrl)));
movieMetadata.addImage(new WebImage(Uri.parse(bigImageUrl)));
JSONObject jsonObj = null;
try {
jsonObj = new JSONObject();
jsonObj.put(KEY_DESCRIPTION, subTitle);
} catch (JSONException e) {
Log.e(TAG, "Failed to add description to the json object", e);
}
return new MediaInfo.Builder(url)
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setContentType(mimeType)
.setMetadata(movieMetadata)
.setMediaTracks(tracks)
.setStreamDuration(duration * 1000)
.setCustomData(jsonObj)
.build();
}
示例5: a
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
public static void a(JSONObject paramJSONObject, List<WebImage> paramList)
{
JSONArray localJSONArray;
if ((paramList != null) && (!paramList.isEmpty()))
{
localJSONArray = new JSONArray();
Iterator localIterator = paramList.iterator();
while (localIterator.hasNext()) {
localJSONArray.put(((WebImage)localIterator.next()).a());
}
}
try
{
paramJSONObject.put("images", localJSONArray);
return;
}
catch (JSONException localJSONException) {}
}
示例6: buildMediaInfo
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
private static MediaInfo buildMediaInfo(String title, String subTitle, String studio,
String url, String imgUrl, String bigImageUrl, List<MediaTrack> tracks) {
MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, subTitle);
movieMetadata.putString(MediaMetadata.KEY_TITLE, title);
movieMetadata.putString(MediaMetadata.KEY_STUDIO, studio);
movieMetadata.addImage(new WebImage(Uri.parse(imgUrl)));
movieMetadata.addImage(new WebImage(Uri.parse(bigImageUrl)));
return new MediaInfo.Builder(url)
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setContentType(getMediaType())
.setMetadata(movieMetadata)
.setMediaTracks(tracks)
.build();
}
示例7: mediaInfo
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
private static MediaInfo mediaInfo(EntryModel entry) {
MediaMetadata mediaMetadata = new MediaMetadata(entry.getType() == Constants.TYPE_SONG ?
MediaMetadata.MEDIA_TYPE_MUSIC_TRACK : MediaMetadata.MEDIA_TYPE_MOVIE);
mediaMetadata.putString(MediaMetadata.KEY_TITLE, entry.getParent() != null ?
entry.getParent() : entry.getTitle());
mediaMetadata.putString(MediaMetadata.KEY_SUBTITLE, entry.getParent() != null ?
entry.getTitle() : entry.getLink());
Uri imageUri = Uri.parse(entry.getPictureURL(true));
mediaMetadata.addImage(new WebImage(imageUri));
mediaMetadata.addImage(new WebImage(imageUri));
return new MediaInfo.Builder(entry.getLink())
.setContentType((entry.getType() == Constants.TYPE_SONG ? "audio/" : "video/") +
FilenameUtils.getExtension(entry.getLink()))
.setStreamType(entry.getType() == Constants.TYPE_LIVE ?
MediaInfo.STREAM_TYPE_LIVE : MediaInfo.STREAM_TYPE_BUFFERED)
.setMetadata(mediaMetadata)
.build();
}
示例8: buildMediaInfo
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
public static MediaInfo buildMediaInfo(String title,
String studio,
String url,
boolean isLiveStream) {
MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
movieMetadata.putString(MediaMetadata.KEY_TITLE, title);
movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, isLiveStream ? "Live" : "On Demand");
movieMetadata.putString(MediaMetadata.KEY_STUDIO, studio);
movieMetadata.addImage(new WebImage(Uri.parse("http://cdn.nhl.com/nhl/images/logos/large.png")));
movieMetadata.addImage(new WebImage(Uri.parse("https://gcls.herokuapp.com/static/logo_por.jpg")));
return new MediaInfo.Builder(url)
.setStreamType(isLiveStream ? MediaInfo.STREAM_TYPE_LIVE : MediaInfo.STREAM_TYPE_BUFFERED)
.setContentType("application/vnd.apple.mpegurl")
.setMetadata(movieMetadata)
.build();
}
示例9: buildMediaInfo
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
private MediaInfo buildMediaInfo(String mediaUrl, String contentType, String title, String subtitle, String studio, String imgUrl, String bigImgUrl) {
// List<MediaTrack> mediaTracks = buildMediaTracks();
// TextTrackStyle textTrackStyle = TextTrackStyle.fromSystemSettings(this);
MediaMetadata metadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
metadata.putString(MediaMetadata.KEY_TITLE, title);
metadata.putString(MediaMetadata.KEY_SUBTITLE, subtitle);
metadata.putString(MediaMetadata.KEY_STUDIO, studio);
metadata.addImage(new WebImage(Uri.parse(imgUrl)));
metadata.addImage(new WebImage(Uri.parse(bigImgUrl)));
return new MediaInfo.Builder(mediaUrl)
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setContentType(contentType)
// .setMediaTracks(mediaTracks)
// .setTextTrackStyle(textTrackStyle)
.setMetadata(metadata)
.build();
}
示例10: fromMediaInfo
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
/**
* 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;
}
示例11: toMediaInfo
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
/**
* Builds and returns a {@link MediaInfo} that was wrapped in a {@link Bundle} by
*/
public static MediaInfo toMediaInfo(Bundle wrapper) {
if (null == wrapper) {
return null;
}
MediaMetadata metaData = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
metaData.putString(MediaMetadata.KEY_SUBTITLE, wrapper.getString(MediaMetadata.KEY_SUBTITLE));
metaData.putString(MediaMetadata.KEY_TITLE, wrapper.getString(MediaMetadata.KEY_TITLE));
metaData.putString(MediaMetadata.KEY_STUDIO, wrapper.getString(MediaMetadata.KEY_STUDIO));
ArrayList<String> images = wrapper.getStringArrayList(KEY_IMAGES);
if (null != images && !images.isEmpty()) {
for (String url : images) {
Uri uri = Uri.parse(url);
metaData.addImage(new WebImage(uri));
}
}
return new MediaInfo.Builder(wrapper.getString(KEY_URL)).setStreamType(wrapper.getInt(KEY_STREAM_TYPE))
.setContentType(wrapper.getString(KEY_CONTENT_TYPE))
.setMetadata(metaData)
.build();
}
示例12: PlayRemote
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
public static void PlayRemote(String title, String url, String iconurl){
Log.i("CAST",title);
MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MUSIC_TRACK);
movieMetadata.putString(MediaMetadata.KEY_TITLE, title);
//movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, "MySubTitle");
movieMetadata.addImage(new WebImage(Uri.parse(iconurl)));
//movieMetadata.addImage(new WebImage(Uri.parse(mSelectedMedia.getImage(1))));
MediaInfo mediaInfo = new MediaInfo.Builder(url)
.setStreamType(MediaInfo.STREAM_TYPE_LIVE)
.setContentType("audio/ogg")
.setMetadata(movieMetadata)
//.setStreamDuration(mSelectedMedia.getDuration() * 1000)
.build();
RemoteMediaClient remoteMediaClient = mCastSession.getRemoteMediaClient();
remoteMediaClient.load(mediaInfo, true);
}
示例13: buildMediaInfo
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
private MediaInfo buildMediaInfo() {
MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, episode.getAnime().getTitle());
movieMetadata.putString(MediaMetadata.KEY_TITLE, episode.getTitle());
movieMetadata.addImage(new WebImage(Uri.parse(episode.getAnime().getCover())));
return new MediaInfo.Builder(videoUrl)
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setContentType("videos/mp4")
.setMetadata(movieMetadata)
.setStreamDuration(exoPlayer.getDuration() * 1000)
.build();
}
示例14: playMedia
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
private void playMedia(String url, SubtitleInfo subtitleInfo, String mimeType, String title,
String description, String iconSrc, boolean shouldLoop,
LaunchListener listener) {
MediaMetadata mMediaMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
mMediaMetadata.putString(MediaMetadata.KEY_TITLE, title);
mMediaMetadata.putString(MediaMetadata.KEY_SUBTITLE, description);
if (iconSrc != null) {
Uri iconUri = Uri.parse(iconSrc);
WebImage image = new WebImage(iconUri, 100, 100);
mMediaMetadata.addImage(image);
}
List<MediaTrack> mediaTracks = new ArrayList<>();
if(subtitleInfo != null) {
MediaTrack subtitle = new MediaTrack.Builder(MEDIA_TRACK_ID, MediaTrack.TYPE_TEXT)
.setName(subtitleInfo.getLabel())
.setSubtype(MediaTrack.SUBTYPE_SUBTITLES)
.setContentId(subtitleInfo.getUrl())
.setContentType(subtitleInfo.getMimeType())
.setLanguage(subtitleInfo.getLanguage())
.build();
mediaTracks.add(subtitle);
}
com.google.android.gms.cast.MediaInfo mediaInformation = new com.google.android.gms.cast.MediaInfo.Builder(url)
.setContentType(mimeType)
.setStreamType(com.google.android.gms.cast.MediaInfo.STREAM_TYPE_BUFFERED)
.setMetadata(mMediaMetadata)
.setStreamDuration(1000)
.setCustomData(null)
.setMediaTracks(mediaTracks)
.build();
playMedia(mediaInformation, applicationID, listener);
}
示例15: toCastMediaMetadata
import com.google.android.gms.common.images.WebImage; //导入依赖的package包/类
/**
* Helper method to convert a {@link android.media.MediaMetadata} to a
* {@link MediaInfo} used for sending media to the receiver app.
*
* @param track {@link MediaMetadata}
* @param customData custom data specifies the local mediaId used by the player.
* @return mediaInfo {@link MediaInfo}
*/
private static MediaInfo toCastMediaMetadata(MediaMetadata track,
JSONObject customData) {
com.google.android.gms.cast.MediaMetadata mediaMetadata
= new com.google.android.gms.cast.MediaMetadata(com.google.android.gms.cast.MediaMetadata.MEDIA_TYPE_MUSIC_TRACK);
mediaMetadata.putString(com.google.android.gms.cast.MediaMetadata.KEY_TITLE,
track.getDescription().getTitle() == null ? "" : track.getDescription().getTitle().toString());
mediaMetadata.putString(com.google.android.gms.cast.MediaMetadata.KEY_SUBTITLE,
track.getDescription().getSubtitle() == null ? "" : track.getDescription().getSubtitle().toString());
mediaMetadata.putString(com.google.android.gms.cast.MediaMetadata.KEY_ALBUM_ARTIST, track.getString(MediaMetadataCompat.METADATA_KEY_ALBUM_ARTIST));
mediaMetadata.putString(com.google.android.gms.cast.MediaMetadata.KEY_ALBUM_TITLE, track.getString(MediaMetadataCompat.METADATA_KEY_ALBUM));
WebImage image = new WebImage(
new Uri.Builder().encodedPath(
track.getString(MediaMetadataCompat.METADATA_KEY_ALBUM_ART_URI))
.build());
// First image is used by the receiver for showing the audio album art.
mediaMetadata.addImage(image);
// Second image is used by Cast Companion Library on the full screen activity that is shown
// when the cast dialog is clicked.
mediaMetadata.addImage(image);
MediaId id = MediaProvider.getInstance().getMediaId(track.getDescription().getMediaId());
//noinspection ResourceType
return new MediaInfo.Builder(track.getString(MediaProvider.CUSTOM_METADATA_TRACK_SOURCE))
.setContentType(id.type == MediaId.TYPE_AUDIO ? MIME_TYPE_AUDIO_MPEG : MIME_TYPE_VIDEO_MPEG)
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setMetadata(mediaMetadata)
.setCustomData(customData)
.build();
}