GoogleCastAndroidMediaStatus.fromMap constructor

GoogleCastAndroidMediaStatus.fromMap(
  1. Map<String, dynamic> map
)

Creates a media status instance from a map.

Implementation

factory GoogleCastAndroidMediaStatus.fromMap(Map<String, dynamic> map) {
  return GoogleCastAndroidMediaStatus(
    mediaSessionID: map['mediaSessionId']?.toInt() ?? 0,
    playerState: CastMediaPlayerStateAndroid.fromMap(map['playerState']),
    idleReason: map['idleReason'] != null
        ? GoogleCastIdleReasonAndroid.fromMap(map['idleReason'])
        : null,
    playbackRate: map['playbackRate'] ?? 1,
    mediaInformation: map['media'] != null
        ? GoogleCastMediaInformationAndroid.fromMap(
            Map<String, dynamic>.from(map['media']))
        : null,

    volume: map['volume']?['level'] ?? 0,
    isMuted: map['volume']?['muted'] ?? true,
    repeatMode: GoogleCastRepeatModeAndroid.fromMap(map['repeatMode']),
    currentItemId: map['currentItemId']?.toInt(),
    activeTrackIds:
        List<int>.from(jsonDecode(map['activeTrackIds'] ?? '[]') ?? []),

    // adBreakStatus: map['adBreakStatus'] != null
    //     ? GoogleCastBrakeStatus.fromMap(map['adBreakStatus'])
    //     : null,
    // liveSeekableRange: map['liveSeekableRange'] != null
    //     ? GoogleCastMediaLiveSeekableRange.fromMap(map['liveSeekableRange'])
    //     : null,
    // queueData: map['queueData'] != null
    //     ? GoogleCastMediaQueueData.fromMap(map['queueData'])
    //     : null,
  );
}