Line data Source code
1 : import 'package:flutter_chrome_cast/enums/media_metadata_type.dart';
2 : import 'cast_media_metadata.dart';
3 :
4 : ///Describes a generic media artifact.
5 : class GoogleCastGenericMediaMetadata extends GoogleCastMediaMetadata {
6 : ///optional Descriptive title of the content.
7 : /// Player can independently retrieve title
8 : /// using content_id or it can be given by
9 : /// the sender in the Load message
10 : final String? title;
11 :
12 : /// optional Descriptive subtitle of the content.
13 : /// Player can independently retrieve title using
14 : /// content_id or it can be given by the sender
15 : /// in the Load message
16 : final String? subtitle;
17 :
18 : ///optional Array of URL(s) to an image associated with the content.
19 : ///The initial value of the field can be provided by the sender in the
20 : ///Load message. Should provide recommended sizes
21 :
22 : ///optional ISO 8601 date and time
23 : /// this content was released. Player can
24 : /// independently retrieve title using
25 : /// content_id or it can be given
26 : /// by the sender in the Load message
27 : final DateTime? releaseDate;
28 :
29 : /// Creates a generic media metadata instance.
30 0 : GoogleCastGenericMediaMetadata({
31 : this.title,
32 : this.subtitle,
33 : super.images,
34 : this.releaseDate,
35 0 : }) : super(metadataType: GoogleCastMediaMetadataType.genericMediaMetadata);
36 0 : @override
37 : Map<String, dynamic> toMap() {
38 0 : return {
39 0 : 'metadataType': metadataType.value,
40 0 : 'title': title,
41 0 : 'subtitle': subtitle,
42 0 : 'images': images?.map((x) => x.toMap()).toList(),
43 0 : 'releaseDate': releaseDate?.millisecondsSinceEpoch,
44 0 : }..removeWhere((key, value) => value == null);
45 : }
46 : }
|