Line data Source code
1 : import 'package:flutter_chrome_cast/lib.dart';
2 :
3 : /// Represents a media track for iOS platforms, extending [GoogleCastMediaTrack].
4 : ///
5 : /// This class is used to model media track information specific to iOS when working
6 : /// with Google Cast. It provides a convenient way to construct a media track from a map.
7 : class IosMediaTrack extends GoogleCastMediaTrack {
8 : /// Creates an [IosMediaTrack] instance.
9 : ///
10 : /// [trackContentType], [trackId], and [type] are required. Other parameters are optional.
11 0 : IosMediaTrack({
12 : required super.trackContentType,
13 : required super.trackId,
14 : required super.type,
15 : super.customData,
16 : super.language,
17 : super.name,
18 : super.subtype,
19 : super.trackContentId,
20 : });
21 :
22 : /// Creates an [IosMediaTrack] from a [Map] representation, typically from platform channels.
23 : ///
24 : /// The [json] map should contain keys matching the expected track properties.
25 0 : factory IosMediaTrack.fromMap(Map json) {
26 0 : return IosMediaTrack(
27 0 : trackContentType: json['content_type'],
28 0 : trackId: json['id'],
29 0 : type: TrackType.values[json['type']],
30 0 : language: Rfc5646Language.fromMap(json['language_code']),
31 0 : name: json['name'],
32 0 : subtype: json['subtype'] != null
33 0 : ? TextTrackType.values[json['subtype']]
34 : : null,
35 0 : trackContentId: json['content_id'],
36 0 : customData: json['custom_data'],
37 : );
38 : }
39 : }
|