Line data Source code
1 : import 'package:flutter_chrome_cast/lib.dart';
2 :
3 : /// Represents the media status for a Google Cast session on iOS.
4 : ///
5 : /// This class extends [GoggleCastMediaStatus] and provides additional
6 : /// iOS-specific mapping and construction from platform channel data.
7 : class GoogleCastIOSMediaStatus extends GoggleCastMediaStatus {
8 : /// Creates a new [GoogleCastIOSMediaStatus] instance.
9 : ///
10 : /// All parameters are forwarded to the base [GoggleCastMediaStatus].
11 1 : GoogleCastIOSMediaStatus({
12 : required super.mediaSessionID,
13 : required super.playerState,
14 : required super.playbackRate,
15 : required super.volume,
16 : required super.isMuted,
17 : required super.repeatMode,
18 : super.activeTrackIds,
19 : super.adBreakStatus,
20 : super.currentItemId,
21 : super.idleReason,
22 : super.liveSeekableRange,
23 : super.mediaInformation,
24 : // super.queueData,
25 : });
26 :
27 : /// Creates a [GoogleCastIOSMediaStatus] from a map received from the platform channel.
28 : ///
29 : /// The [map] parameter must contain the expected keys and value types as sent from iOS.
30 1 : factory GoogleCastIOSMediaStatus.fromMap(Map<String, dynamic> map) {
31 1 : return GoogleCastIOSMediaStatus(
32 2 : mediaSessionID: map['mediaSessionID']?.toInt() ?? 0,
33 2 : playerState: CastMediaPlayerState.values[map['playerState']],
34 1 : idleReason: map['idleReason'] != null
35 0 : ? GoogleCastMediaIdleReason.values[map['idleReason']]
36 : : null,
37 1 : playbackRate: map['playbackRate'] ?? 0,
38 1 : mediaInformation: map['mediaInformation'] != null
39 0 : ? GoogleCastMediaInformationIOS.fromMap(
40 0 : Map<String, dynamic>.from(map['mediaInformation']))
41 : : null,
42 :
43 1 : volume: map['volume'] ?? 0,
44 1 : isMuted: map['isMuted'] ?? true,
45 2 : repeatMode: GoogleCastMediaRepeatMode.values[(map['repeatMode'])],
46 2 : currentItemId: map['currentItemId']?.toInt(),
47 :
48 2 : activeTrackIds: List<int>.from(map['activeTrackIds'] ?? []),
49 : // adBreakStatus: map['adBreakStatus'] != null
50 : // ? GoogleCastBrakeStatus.fromMap(map['adBreakStatus'])
51 : // : null,
52 : // liveSeekableRange: map['liveSeekableRange'] != null
53 : // ? GoogleCastMediaLiveSeekableRange.fromMap(map['liveSeekableRange'])
54 : // : null,
55 : // queueData: map['queueData'] != null
56 : // ? GoogleCastMediaQueueData.fromMap(map['queueData'])
57 : // : null,
58 : );
59 : }
60 : }
|