// Play song from persistentSongID
 public void playSong(Song song)
 {
     currentSong = song;
     if (song.streamingURL == null)
     {
         MusicQuery  musicQuery = new MusicQuery();
         MPMediaItem mediaItem  = musicQuery.queryForSongWithId(song.songID);
         if (mediaItem != null)
         {
             NSUrl Url = mediaItem.AssetURL;
             item = AVPlayerItem.FromUrl(Url);
             if (item != null)
             {
                 this.avPlayer.ReplaceCurrentItemWithPlayerItem(item);
             }
             MPNowPlayingInfo np = new MPNowPlayingInfo();
             SetNowPlayingInfo(song, np);
             this.play();
         }
     }
     else
     {
         NSUrl nsUrl = NSUrl.FromString(song.streamingURL);
         MyMusicPlayer.myMusicPlayer?.streamingItem?.RemoveObserver(MyMusicPlayer.myMusicPlayer, "status");
         streamingItem = AVPlayerItem.FromUrl(nsUrl);
         streamingItem.AddObserver(this, new NSString("status"), NSKeyValueObservingOptions.New, avPlayer.Handle);
         avPlayer.ReplaceCurrentItemWithPlayerItem(streamingItem);
         streamingItemPaused = false;
         //NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("playerItemDidReachEnd:"), AVPlayerItem.DidPlayToEndTimeNotification, streamingItem);
     }
 }
        // Get the songs from the music library
        public static void querySongs()
        {
            MusicQuery musicQuery = new MusicQuery();

            artistSongs = musicQuery.queryForSongs();
            artistCount = artistSongs.Count;

            var artists = artistSongs.Values;

            songCount = 0;
            foreach (List <Song> songs in artists)
            {
                songCount += songs.Count;
            }

            searchSongCount   = 0;
            searchArtistCount = 0;
        }