Line data Source code
1 : import 'package:flutter_chrome_cast/enums/media_resume_state.dart';
2 :
3 : ///Enum defining the media control channel resume state.
4 : class GoogleCastMediaSeekOption {
5 : /// The position to seek to.
6 : final Duration position;
7 :
8 : /// Whether the seek is relative to current position.
9 : final bool relative;
10 :
11 : /// The resume state after seeking.
12 : final GoogleCastMediaResumeState resumeState;
13 :
14 : /// Whether to seek to infinity (live content).
15 : final bool seekToInfinity;
16 :
17 : /// Creates a new [GoogleCastMediaSeekOption].
18 2 : GoogleCastMediaSeekOption({
19 : required this.position,
20 : this.relative = false,
21 : this.resumeState = GoogleCastMediaResumeState.play,
22 : this.seekToInfinity = false,
23 : });
24 :
25 : /// Converts these seek options to a map representation.
26 2 : Map<String, dynamic> toMap() {
27 2 : return {
28 4 : 'position': position.inSeconds,
29 2 : 'relative': relative,
30 4 : 'resumeState': resumeState.index,
31 2 : 'seekToInfinity': seekToInfinity,
32 : };
33 : }
34 : }
|