Search in sources :

Example 11 with ImageInfo

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);
}
Also used : ImageInfo(com.connectsdk.core.ImageInfo)

Example 12 with ImageInfo

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);
}
Also used : MediaInfo(com.connectsdk.core.MediaInfo) ArrayList(java.util.ArrayList) ImageInfo(com.connectsdk.core.ImageInfo)

Example 13 with ImageInfo

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);
}
Also used : ImageInfo(com.connectsdk.core.ImageInfo)

Example 14 with ImageInfo

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);
}
Also used : ImageInfo(com.connectsdk.core.ImageInfo)

Example 15 with ImageInfo

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;
    }
}
Also used : RemoteMediaPlayer(com.amazon.whisperplay.fling.media.controller.RemoteMediaPlayer) ArrayList(java.util.ArrayList) JSONException(org.json.JSONException) JSONException(org.json.JSONException) ExecutionException(java.util.concurrent.ExecutionException) MediaInfo(com.connectsdk.core.MediaInfo) JSONObject(org.json.JSONObject) MediaPlayerInfo(com.amazon.whisperplay.fling.media.service.MediaPlayerInfo) FireTVServiceError(com.connectsdk.service.command.FireTVServiceError) ArrayList(java.util.ArrayList) List(java.util.List) ImageInfo(com.connectsdk.core.ImageInfo)

Aggregations

ImageInfo (com.connectsdk.core.ImageInfo)18 MediaInfo (com.connectsdk.core.MediaInfo)4 ServiceCommandError (com.connectsdk.service.command.ServiceCommandError)2 ArrayList (java.util.ArrayList)2 SubtitleWrapper (butter.droid.base.providers.subs.model.SubtitleWrapper)1 RemoteMediaPlayer (com.amazon.whisperplay.fling.media.controller.RemoteMediaPlayer)1 MediaPlayerInfo (com.amazon.whisperplay.fling.media.service.MediaPlayerInfo)1 MediaPlayer (com.connectsdk.service.capability.MediaPlayer)1 FireTVServiceError (com.connectsdk.service.command.FireTVServiceError)1 MediaMetadata (com.google.android.gms.cast.MediaMetadata)1 MalformedURLException (java.net.MalformedURLException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 List (java.util.List)1 ExecutionException (java.util.concurrent.ExecutionException)1 JSONException (org.json.JSONException)1 JSONObject (org.json.JSONObject)1