如果我在美国并且想播放两门电影俱乐部的歌曲“Sun”,我会使用 ID544390857
。
我可以在(例如)中执行此操作systemMusicPlayer
Apple Music 中开始播放该歌曲。
如果我的朋友在英国并且想要播放同一首歌,请发送544390857
到 systemMusicPlayer 导致歌曲无法被识别(并且没有播放)。
该歌曲的 GB 店面等效 ID 是674900368
.
我有两个问题:
谢谢你提供的所有帮助!
你可以尝试使用苹果音乐 API https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/AppleMusicWebServicesReference/index.html获取正确的信息:
(只有当您事先不知道歌曲名称,只知道songIds时才需要步骤1)
-
根据 storeFrontCountryCode(“美国”)和 SongId(与“美国”商店匹配),您可以使用以下方法获取歌曲名称(“Sun”)“获取歌曲”API 调用。 https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/AppleMusicWebServicesReference/GetaSingleSong.html
-
您需要检索用户当前的storeFront。你可以这样做requestStorefrontCountryCodeWithCompletionHandler https://developer.apple.com/documentation/storekit/skcloudservicecontroller/2909076-requeststorefrontcountrycodewith?language=objc)
你会得到类似“GB”的东西。
-
使用songName('Sun')和用户storeFrontCountryCode('GB'),我们做了一个“搜索目录资源” https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/AppleMusicWebServicesReference/Searchforresources.html获取正确的歌曲 ID。
最终,为了防止歌曲名称重复的问题,您可以将艺术家姓名添加到“搜索目录资源”API 调用中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)