3

我浏览了以下链接:- https://developer.apple.com/videos/play/wwdc2017/502/?time=362

我还从上述链接下载了演示项目:- https://developer.apple.com/sample-code/wwdc/2017/Interacting-with-Apple-Music-Content.zip

需要帮助来清除我对音乐套件的 2 个疑问:-

1.我们可以在我们的应用程序中使用musickit播放音乐视频吗?(或者我们需要AVKit来播放视频)

经验:-

  1. 请参阅此链接:- https://developer.apple.com/documentation/mediaplayer,其中提到“协议 MPSystemMusicPlayerController用于在音乐应用程序中播放视频的协议(是否仅表示默认的苹果音乐应用程序或我们的音乐应用程序)。”

    我们还可以使用苹果音乐 api 获取音乐视频列表(src:- https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/AppleMusicWebServicesReference/GetaMusicVideo.html#//apple_ref/doc/ uid/TP40017625-CH18-SW1):-

    获取https://api.music.apple.com/v1/catalog/ {storefront}/music-videos/{id}

    但我们只能获取视频的预览网址。那么,我们究竟如何才能在我们的应用程序中播放完整或完整的音乐视频,而不是使用 musickit 的苹果音乐应用程序呢?

  2. 从前面提到的演示应用程序中,请参阅 Controllers 部分中的 MusicPlayerManager.swift 文件并找到以下行:-

    让 musicPlayerController = MPMusicPlayerController.systemMusicPlayer

    musicPlayerController 变量的类型是MPMusicPlayerController 和 MPSystemMusicPlayerController,因此它应该能够播放音频和视频文件。 MPSystemMusicPlayerController 中还有一个openToPlay(_ queueDescriptor: MPMusicPlayerQueueDescriptor)方法可以播放视频,但不确定在 MPMusicPlayerQueueDescriptor 中定义什么

2. 音乐视频是一种媒体类型还是专辑的一部分

在 wwdc 视频和演示应用程序中都只定义了四种媒体类型。来自演示应用程序中的 MediaItem.swift 文件:-

enum MediaType: String {
    case songs, albums, stations, playlists
}

这让我对什么是音乐视频感到困惑。从 wwdc 看来,音乐视频似乎是专辑的一部分,它与专辑的关系可以在这里找到:- https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/AppleMusicWebServicesReference/MusicVideo.html#/ /apple_ref/doc/uid/TP40017625-CH29-SW1

请澄清以上疑虑。任何帮助表示赞赏。

4

0 回答 0