public override async Task <TrackFile> GetDownloadableTrackAsync(Track track)
        {
            // Only property we need to set is Track.StoreId (see Google.Music/GoogleMusicApi.UWP/Requests/Data/StreamUrlGetRequest.cs:32)
            var streamUrl = await client.GetStreamUrlAsync(new GoogleMusicApi.Structure.Track {
                StoreId = track.Id
            });

            if (streamUrl == null)
            {
                throw new InvalidSessionException("Play Music: Stream URL unavailable. Check your subscription is active then try again.");
            }
            // Unfortunately I have forgotten the various stream qualities available on Play Music because my subscription ran out,
            // so I will set the bitrate to -1, i.e. unknown
            // What is known is that all streams are MP3, so this should work.
            return(new TrackFile
            {
                BitRate = -1,
                DownloadUri = streamUrl,
                FileType = MediaFileTypes.Mpeg3Audio,
                Track = track
            });
        }
Exemple #2
0
 /// <summary>
 /// Retrieves a track's downloadable form.
 /// </summary>
 /// <param name="track">The track to download.</param>
 /// <returns>A <see cref="TrackFile"/> containing file metadata and the URI of the track.</returns>
 public abstract Task <TrackFile> GetDownloadableTrackAsync(Track track);