更新时间:2023-12-03 17:45:22
从 watchOS 2 开始,现在可以使用 WKAudioFilePlayer
或 WKInterfaceMovie
.
This is now possible as of watchOS 2 using WKAudioFilePlayer
or WKInterfaceMovie
.
NSURL *assetURL = [[NSBundle mainBundle] URLForResource:@"file" withExtension:@"wav"];
WKAudioFilePlayer
示例:
WKAudioFileAsset *asset = [WKAudioFileAsset assetWithURL:assetURL];
WKAudioFilePlayerItem *playerItem = [WKAudioFilePlayerItem playerItemWithAsset:asset];
WKAudioFilePlayer *audioFilePlayer = [WKAudioFilePlayer playerWithPlayerItem:playerItem];
[audioFilePlayer play];
WKInterfaceMovie
示例:
[self presentMediaPlayerControllerWithURL:assetURL options:nil completion:nil];