use of com.connectsdk.core.ImageInfo in project butter-android by butterproject.
the class CastService method displayImage.
@Override
public void displayImage(MediaInfo mediaInfo, LaunchListener listener) {
String mediaUrl = null;
String mimeType = null;
String title = null;
String desc = null;
String iconSrc = null;
if (mediaInfo != null) {
mediaUrl = mediaInfo.getUrl();
mimeType = mediaInfo.getMimeType();
title = mediaInfo.getTitle();
desc = mediaInfo.getDescription();
if (mediaInfo.getImages() != null && mediaInfo.getImages().size() > 0) {
ImageInfo imageInfo = mediaInfo.getImages().get(0);
iconSrc = imageInfo.getUrl();
}
}
displayImage(mediaUrl, mimeType, title, desc, iconSrc, listener);
}
use of com.connectsdk.core.ImageInfo in project butter-android by butterproject.
the class DLNAMediaInfoParser method getMediaInfo.
public static MediaInfo getMediaInfo(String str) {
String url = DLNAMediaInfoParser.getURL(str);
String title = DLNAMediaInfoParser.getTitle(str);
String mimeType = DLNAMediaInfoParser.getMimeType(str);
String description = DLNAMediaInfoParser.getArtist(str) + "\n" + DLNAMediaInfoParser.getAlbum(str);
String iconUrl = DLNAMediaInfoParser.getThumbnail(str);
ArrayList<ImageInfo> list = new ArrayList<ImageInfo>();
list.add(new ImageInfo(iconUrl));
return new MediaInfo(url, mimeType, title, description, list);
}
use of com.connectsdk.core.ImageInfo in project butter-android by butterproject.
the class CastService method playMedia.
@Override
public void playMedia(MediaInfo mediaInfo, boolean shouldLoop, LaunchListener listener) {
String mediaUrl = null;
String subsUrl = null;
String mimeType = null;
String title = null;
String desc = null;
String iconSrc = null;
if (mediaInfo != null) {
mediaUrl = mediaInfo.getUrl();
subsUrl = mediaInfo.getSubsUrl();
mimeType = mediaInfo.getMimeType();
title = mediaInfo.getTitle();
desc = mediaInfo.getDescription();
if (mediaInfo.getImages() != null && mediaInfo.getImages().size() > 0) {
ImageInfo imageInfo = mediaInfo.getImages().get(0);
iconSrc = imageInfo.getUrl();
}
}
playMedia(mediaUrl, subsUrl, mimeType, title, desc, iconSrc, shouldLoop, listener);
}
use of com.connectsdk.core.ImageInfo in project butter-android by butterproject.
the class WebOSTVService method playMedia.
@Override
public void playMedia(MediaInfo mediaInfo, boolean shouldLoop, MediaPlayer.LaunchListener listener) {
String mediaUrl = null;
String mimeType = null;
String title = null;
String desc = null;
String iconSrc = null;
if (mediaInfo != null) {
mediaUrl = mediaInfo.getUrl();
mimeType = mediaInfo.getMimeType();
title = mediaInfo.getTitle();
desc = mediaInfo.getDescription();
if (mediaInfo.getImages() != null && mediaInfo.getImages().size() > 0) {
ImageInfo imageInfo = mediaInfo.getImages().get(0);
iconSrc = imageInfo.getUrl();
}
}
playMedia(mediaUrl, mimeType, title, desc, iconSrc, shouldLoop, listener);
}
use of com.connectsdk.core.ImageInfo in project butter-android by butterproject.
the class FireTVService method getMediaInfo.
/**
* Get MediaInfo available only during playback otherwise returns an error
* @param listener
*/
@Override
public void getMediaInfo(final MediaInfoListener listener) {
final String error = "Error getting media info";
RemoteMediaPlayer.AsyncFuture<MediaPlayerInfo> asyncFuture = null;
try {
asyncFuture = remoteMediaPlayer.getMediaInfo();
handleAsyncFutureWithConversion(listener, asyncFuture, new ConvertResult<MediaInfo, MediaPlayerInfo>() {
@Override
public MediaInfo convert(MediaPlayerInfo data) throws JSONException {
JSONObject metaJson = null;
metaJson = new JSONObject(data.getMetadata());
List<ImageInfo> images = null;
if (metaJson.has(META_ICON_IMAGE)) {
images = new ArrayList<ImageInfo>();
images.add(new ImageInfo(metaJson.getString(META_ICON_IMAGE)));
}
MediaInfo mediaInfo = new MediaInfo(data.getSource(), metaJson.getString(META_MIME_TYPE), metaJson.getString(META_TITLE), metaJson.getString(META_DESCRIPTION), images);
return mediaInfo;
}
}, error);
} catch (Exception e) {
Util.postError(listener, new FireTVServiceError(error));
return;
}
}
Aggregations