Search in sources :

Example 16 with MediaInfo

use of com.google.android.gms.cast.MediaInfo in project AntennaPod by AntennaPod.

the class CastManager method getRemoteMediaUrl.

/**
     * Returns the url for the media that is currently playing on the remote device. If there is no
     * connection, this will return <code>null</code>.
     *
     * @throws NoConnectionException If no connectivity to the device exists
     * @throws TransientNetworkDisconnectionException If framework is still trying to recover from
     * a possibly transient loss of network
     */
public String getRemoteMediaUrl() throws TransientNetworkDisconnectionException, NoConnectionException {
    checkConnectivity();
    if (remoteMediaPlayer != null && remoteMediaPlayer.getMediaInfo() != null) {
        MediaInfo info = remoteMediaPlayer.getMediaInfo();
        remoteMediaPlayer.getMediaStatus().getPlayerState();
        return info.getContentId();
    }
    throw new NoConnectionException();
}
Also used : MediaInfo(com.google.android.gms.cast.MediaInfo) NoConnectionException(com.google.android.libraries.cast.companionlibrary.cast.exceptions.NoConnectionException)

Aggregations

MediaInfo (com.google.android.gms.cast.MediaInfo)16 MediaMetadata (com.google.android.gms.cast.MediaMetadata)9 WebImage (com.google.android.gms.common.images.WebImage)5 NoConnectionException (com.google.android.libraries.cast.companionlibrary.cast.exceptions.NoConnectionException)5 JSONObject (org.json.JSONObject)4 Uri (android.net.Uri)3 TransientNetworkDisconnectionException (com.google.android.libraries.cast.companionlibrary.cast.exceptions.TransientNetworkDisconnectionException)3 Calendar (java.util.Calendar)3 JSONException (org.json.JSONException)3 Bitmap (android.graphics.Bitmap)2 MediaMetadataCompat (android.support.v4.media.MediaMetadataCompat)2 NotFoundException (android.content.res.Resources.NotFoundException)1 SQLiteException (android.database.sqlite.SQLiteException)1 Point (android.graphics.Point)1 Drawable (android.graphics.drawable.Drawable)1 Bundle (android.os.Bundle)1 Builder (com.google.android.gms.cast.Cast.CastOptions.Builder)1 MediaTrack (com.google.android.gms.cast.MediaTrack)1 CastException (com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException)1 FetchBitmapTask (com.google.android.libraries.cast.companionlibrary.utils.FetchBitmapTask)1