【发布时间】:2014-05-15 16:49:38
【问题描述】:
我有一个 AVPlayer,当在表格视图中选择一行时,它会从 URL 流式传输音频。我试图弄清楚如果在播放音频时选择了同一行,我如何暂停音频。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *streamingString = [NSString stringWithFormat:@"%@.json?client_id=fc886d005e29ba78f046e5474e3fdefb", [streamURLArray objectAtIndex:indexPath.row]];
NSURL *streamingURL = [NSURL URLWithString:streamingString];
selectedRow = indexPath.row;
[tableView reloadData];
player = [AVPlayer playerWithURL:streamingURL];
[player play];
player.actionAtItemEnd = AVPlayerActionAtItemEndNone;
}
【问题讨论】:
标签: ios objective-c uitableview avplayer