我将在UniversalMusicPlayer Google Sample的帮助下制作一个在线广播应用。我设法跳过流派和专辑列表,并通过修改MusicProvider类在MusicPlayerActivity中显示直接曲目:
if (MEDIA_ID_ROOT.equals(mediaId)) {
mediaItems.add(createBrowsableMediaItemForRoot(resources));
}
到
if (MEDIA_ID_ROOT.equals(mediaId)) {
mediaItems.add(createMediaItem(buildRadioTrack()));
}
private MediaMetadataCompat buildRadioAamarTrack() {
//noinspection ResourceType
return new MediaMetadataCompat.Builder()
.putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, id)
.putString(MusicProviderSource.CUSTOM_METADATA_TRACK_SOURCE, source)
.putString(MediaMetadataCompat.METADATA_KEY_ALBUM, album)
.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, artist)
.putLong(MediaMetadataCompat.METADATA_KEY_DURATION, duration)
.putString(MediaMetadataCompat.METADATA_KEY_GENRE, genre)
.putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ART_URI, iconUrl)
.putString(MediaMetadataCompat.METADATA_KEY_TITLE, title)
.putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, trackNumber)
.putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, totalTrackCount)
.build();
}
现在我想跳过MusicPlayerActivity并用我的无线电轨道显示FullScreenPlayerActivity(因为这是我唯一的轨道)。无法弄清楚该怎么做。你能帮我解决这个问题吗?