Line data Source code
1 : import 'dart:convert';
2 :
3 : ///Provides the live seekable range with start and end time in seconds.
4 : class GoogleCastMediaLiveSeekableRange {
5 : ///End of the seekable range in seconds.
6 : /// This member is only updated sporadically,
7 : /// so its value is often out of date. Use
8 : /// the getEstimatedLiveSeekableRange method
9 : /// to get an estimate of the real position
10 : /// based on the last information reported
11 : /// by the receiver.
12 : final Duration? end;
13 :
14 : ///A boolean value indicates whether
15 : ///a live stream is ended. If it
16 : ///is done, the end of live seekable
17 : /// range should stop updating.
18 : final bool? isLiveDone;
19 :
20 : ///A boolean value indicates whether
21 : /// the live seekable range is a moving window.
22 : /// If false, it will be either a expanding
23 : /// range or a fixed range meaning live has ended.
24 : final bool? isMovingWindow;
25 :
26 : ///Start of the seekable range in seconds.
27 : ///This member is only updated sporadically,
28 : /// so its value is often out of date. Use
29 : /// the getEstimatedLiveSeekableRange method
30 : /// to get an estimate of the real position
31 : /// based on the last information reported
32 : /// by the receiver.
33 : final Duration? start;
34 :
35 : /// Creates a new [GoogleCastMediaLiveSeekableRange] instance.
36 : ///
37 : /// [end] - End of the seekable range in seconds.
38 : /// [isLiveDone] - Whether the live stream is ended.
39 : /// [isMovingWindow] - Whether the live seekable range is a moving window.
40 : /// [start] - Start of the seekable range in seconds.
41 0 : GoogleCastMediaLiveSeekableRange({
42 : this.end,
43 : this.isLiveDone,
44 : this.isMovingWindow,
45 : this.start,
46 : });
47 :
48 : /// Converts the [GoogleCastMediaLiveSeekableRange] to a map.
49 : ///
50 : /// Returns a [Map] representation of this object.
51 0 : Map<String, dynamic> toMap() {
52 0 : return {
53 0 : 'end': end?.inSeconds,
54 0 : 'isLiveDone': isLiveDone,
55 0 : 'isMovingWindow': isMovingWindow,
56 0 : 'start': start?.inSeconds,
57 : };
58 : }
59 :
60 : /// Creates a [GoogleCastMediaLiveSeekableRange] from a map.
61 : ///
62 : /// [map] - The map to create the instance from.
63 0 : factory GoogleCastMediaLiveSeekableRange.fromMap(Map<String, dynamic> map) {
64 0 : return GoogleCastMediaLiveSeekableRange(
65 0 : end: map['end'] != null ? Duration(seconds: map['end'].toInt()) : null,
66 0 : isLiveDone: map['isLiveDone'],
67 0 : isMovingWindow: map['isMovingWindow'],
68 : start:
69 0 : map['start'] != null ? Duration(seconds: map['start'].toInt()) : null,
70 : );
71 : }
72 :
73 : /// Converts the [GoogleCastMediaLiveSeekableRange] to a JSON string.
74 : ///
75 : /// Returns a JSON string representation of this object.
76 0 : String toJson() => json.encode(toMap());
77 :
78 : /// Creates a [GoogleCastMediaLiveSeekableRange] from a JSON string.
79 : ///
80 : /// [source] - The JSON string to create the instance from.
81 0 : factory GoogleCastMediaLiveSeekableRange.fromJson(String source) =>
82 0 : GoogleCastMediaLiveSeekableRange.fromMap(json.decode(source));
83 : }
|