Skip to content

Instantly share code, notes, and snippets.

@bengongon97
Last active August 10, 2020 05:53
Show Gist options
  • Save bengongon97/984b2c5f44daf6de88ad912ea0423430 to your computer and use it in GitHub Desktop.
Save bengongon97/984b2c5f44daf6de88ad912ea0423430 to your computer and use it in GitHub Desktop.
@Override
public void onItemClick(List<HwAudioPlayItem> myPlayList, int position) {
if (mHwAudioPlayerManager != null && mHwAudioQueueManager != null && mHwAudioQueueManager.getAllPlaylist() != null) {
/*
* 1. Obtains a playlist using the mHwAudioQueueManager.getAllPlaylist() method.
* 2. Compare myPlayList with mHwAudioQueueManager.
*/
if (mHwAudioQueueManager.getAllPlaylist() == myPlayList) {
//If the two playlists are the same, the user-specified song is played.
mHwAudioPlayerManager.play(position);
} else {
//If the two playlists are different, the mHwAudioPlayerManager playlist is updated.
//The music specified by the user is played.
mHwAudioPlayerManager.playList(playList, position, 0);
mHwAudioPlayerManager.setPlayMode(0);
mHwAudioQueueManager.setPlaylist(playList);
Log.w("Playlist", mHwAudioQueueManager.getAllPlaylist() + "");
}
}
}
/*
@Override
public void onItemClick(int position) {
if(mHwAudioPlayerManager != null){
mHwAudioPlayerManager.play(position);
}
}*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment