【发布时间】:2012-07-26 03:19:47
【问题描述】:
当我从我的 ipod 库中选择多首歌曲时,我正在使用 AVPlayer,一旦第一首歌曲播放完毕,这些选定的歌曲就会显示在名为 playlistTableView 的 UITableview 中,它不会继续播放第二首歌曲。我希望播放器继续播放歌曲直到 playlistTableView 中没有歌曲为止。
【问题讨论】:
-
将歌曲传递给播放器的代码是什么?
-
NSURL*assetUrl = [mediaItemCollection.representativeItem valueForProperty:MPMediaItemPropertyAssetURL]; AVURLAsset* 资产 = [AVURLAsset URLAssetWithURL:assetUrl options:nil]; // 创建播放器项目 AVPlayerItem* playerItem = [AVPlayerItem playerItemWithAsset:asset]; [code] // 播放 myPlayer = [AVPlayer playerWithPlayerItem:playerItem]; collectionMutableCopy =[mediaItemCollection.items mutableCopy]; [self.myPlaylistTable reloadData]; [myPlayer 播放];这是我的代码
标签: iphone objective-c ios xcode