watchOS 5支持新的背景音频模式,因此音频应用程序(音频、阴天等)可以直接从手表播放。我正在为我的应用程序开发音频功能,但我必须使用FairPlay DRM。我已经分段aac音频文件与。m3u8播放列表,我正在使用
AVAssetDownloadTask
AVAssetResourceLoaderDelegate
在iPhone上。我想添加一个手表应用程序,在没有手机的情况下播放我的内容。
但我在手表API上看不到类似的东西。AVAssetResourceLoaderDelegate和
AVContentKeySession
在watchOS上不可用,并且
AVAudioPlayer
不需要AVAsset或任何其他方式来完成公平竞争的关键内容(我使用
AVPlayer
在电话里)。
在
Creating Audio Apps for watchOS
在2018年WWDC会议上,主持人说:
在AVAudioEngine的情况下,您可以结合AVAudioPlayer节点实际播放一些DRM内容。现在,您可以播放自己的DRM内容,自己解密,然后为用户播放。
但我还没有找到任何关于
AVAudioEngine
和公平播放音频。
我已经调查过了
AVAudioExportSession
尝试将我的FairPlay内容转换为MP3、AAC或M4A,或其他我可以传输到手表的内容,但它认为任何格式都不兼容:
AVAsset *asset = [self getDownloadedFairplayAsset];
NSArray<NSString *> *possible = [AVAssetExportSession exportPresetsCompatibleWithAsset:asset];
for (NSString *preset in possible)
{
AVAssetExportSession *session = [AVAssetExportSession exportSessionWithAsset:asset presetName:preset];
[session determineCompatibleFileTypesWithCompletionHandler:^(NSArray<AVFileType> * _Nonnull compatibleFileTypes) {
NSLog(@"Compatible types with %@: %@", preset, compatibleFileTypes);
//this is always an empty array
}];
}
所以,我的问题是: