ryanheise / just_audio

Audio Player
1.04k stars 664 forks source link

Play Music From AppleMusic songIds #338

Open xxjonesriderxx opened 3 years ago

xxjonesriderxx commented 3 years ago

Is your feature request related to a problem? Please describe. I can use some audio query tools which are retrieving whole information about all AppleMusic songs, as well of the ids of those songs. But I cannot play those songs.

Describe the solution you'd like It would be nice if I could add music to my list with something like AudioSource.uri(Uri.parse(song.iOSSongID)),

Describe alternatives you've considered Search for apple music songs on your own.

Additional context I'm using your lib to play mp3 files on Android (which works great, thank you!) but would want to play songs on iOS too (over AppleMusic).

ryanheise commented 3 years ago

Relevant API: https://developer.apple.com/documentation/mediaplayer?language=objc This API does not work in the background, but there's a hack/workaround: https://stackoverflow.com/questions/44687912/play-apple-music-in-the-background#44710734

Unfortunately the full set of just_audio features are not available using MPMusicPlayerController. I wonder whether this would be best implemented as a separate plugin. Is there a need to mix playlists of media available via MPMusicPlayerController and say online media available via regular URLs? To implement such mixed playlists, the plugin would have to internally switch between APIs between songs, so gapless playback would be lost. And in that case, you could get equivalent results by using two different player plugins within the app and switching between them in the app.