3

As we can play apple music songs by third party applications on iOS.

As we know Apple given Apple Music Support on tvOS as well. So is it possible to play Apple Music songs from my tvOS application like iOS

On Apple Documentation here it is clearly said that Apple Music is only possible to play by using MPMusicPlayerController but it seems that Apple haven't given access of MPMusicPlayerController in tvOS any idea.

Community
  • 1
  • 1
Anupam Mishra
  • 3,408
  • 5
  • 35
  • 63

2 Answers2

2

Short Answer: No, you are not able to play music from Apple Music in your own apps.


Music Library

MPMusicPlayerController and the rest of the MediaPlayer.framework are a set of classes that allow you to play (and browse) the users Music Library.

The Music Library is actually different to Apple Music, it's the collection of music stored on the users device. This could be music purchased through the iTunes store, songs synced through iTunes on a computer or tracks from Apple Music downloaded to the device for offline playback.

Because the Apple TV isn't a portable device, it doesn't really make sense to have a physical music library on the device (it's permanently connected to the internet) so without a physical music library there is no point giving developers access to it.

This is why MPMusicPlayerController isn't available on tvOS.

Apple Music API

If however you wanted access to an actual Apple Music API (like the one Sonos use), you are also out of luck i'm afraid.

This API allows third parties to connect with the Apple Music platform and allow streaming of music directly from Apple's servers however as far as i've seen, Apple only work with select manufacturers (currently only Sonos that we know of) and it doesn't really make sense for them to open something like that up to the public.

With multitasking and the ability to play Apple Music already on the Apple TV already there isn't really a reason why Apple should need to give developers access to play Apple Music within their own apps.

Own Music

If you actually wanted the ability to play your own music files on tvOS, you could do this using AVAudioPlayer.

liamnichols
  • 12,419
  • 2
  • 43
  • 62
  • As of today with tvOS 11, I'm able to access the Apple Music API on tvOS now, but it appears we are still lacking `MPMusicPlayerController` on tvOS and therefore can't play full-length tracks, am I correct about this? @liamnichols @anupam – Dan Healy Oct 16 '17 at 22:59
0

The Apple Music API is iOS only and isn't (yet) available for apps written for tvOS.

FractalDoctor
  • 2,496
  • 23
  • 32