Line data Source code
1 : import 'package:flutter_chrome_cast/enums/media_metadata_type.dart';
2 :
3 : import 'cast_media_metadata.dart';
4 :
5 : ///Describes a music track media artifact.
6 : class GoogleCastMusicMediaMetadata extends GoogleCastMediaMetadata {
7 : /// Creates a music track media metadata instance.
8 0 : GoogleCastMusicMediaMetadata({
9 : this.albumName,
10 : this.title,
11 : this.albumArtist,
12 : this.artist,
13 : this.composer,
14 : this.trackNumber,
15 : this.discNumber,
16 : super.images,
17 : this.releaseDate,
18 0 : }) : super(metadataType: GoogleCastMediaMetadataType.musicTrackMediaMetadata);
19 :
20 : /// optional Album or collection from which this track
21 : /// is drawn. Player can independently retrieve albumName
22 : /// using content_id or it can be given by the sender
23 : /// in the Load message
24 : final String? albumName;
25 :
26 : /// optional Name of the track
27 : /// (for example, song title). Player can
28 : /// independently retrieve title using
29 : /// content_id or it can be given by
30 : /// the sender in the Load message
31 : final String? title;
32 :
33 : ///optional Name of the artist associated with
34 : /// the album featuring this track. Player can
35 : /// independently retrieve albumArtist using
36 : /// content_id or it can be given by the
37 : /// sender in the Load message
38 : final String? albumArtist;
39 :
40 : ///optional Name of the artist associated
41 : /// with the media track. Player can
42 : /// independently retrieve artist using
43 : /// content_id or it can be given
44 : /// by the sender in the Load message
45 : final String? artist;
46 :
47 : ///optional Name of the composer associated with the
48 : /// media track. Player can independently retrieve
49 : /// composer using content_id or it can be
50 : /// given by the sender in the Load message
51 : final String? composer;
52 :
53 : ///optional Number of the track on the album
54 : final int? trackNumber;
55 :
56 : ///optional Number of the volume (for example, a disc) of the album
57 : final int? discNumber;
58 :
59 : ///optional Array of URL(s) to an image associated
60 : ///with the content. The initial value of the
61 : ///field can be provided by the sender in
62 : ///the Load message. Should provide recommended sizes
63 :
64 : ///optional ISO 8601 date and time
65 : /// this content was released. Player
66 : /// can independently retrieve releaseDate
67 : /// using content_id or it can be given
68 : /// by the sender in the Load message
69 : final DateTime? releaseDate;
70 0 : @override
71 : Map<String, dynamic> toMap() {
72 0 : return {
73 0 : 'metadataType': metadataType.value,
74 0 : 'albumName': albumName,
75 0 : 'title': title,
76 0 : 'albumArtist': albumArtist,
77 0 : 'artist': artist,
78 0 : 'composer': composer,
79 0 : 'trackNumber': trackNumber,
80 0 : 'discNumber': discNumber,
81 0 : 'images': images?.map((x) => x.toMap()).toList(),
82 0 : 'releaseDate': releaseDate?.millisecondsSinceEpoch,
83 : };
84 : }
85 : }
|