【发布时间】:2019-08-17 14:10:56
【问题描述】:
您好,我正在尝试使用以下方法在收藏视图单元格中播放视频:Link
当我运行我的应用程序视频播放成功。 再次完成视频后,我们按下开始按钮,它崩溃了。并显示以下错误。
WF: _WebFilterIsActive returning: NO
警告:AVF 上下文无法用于 +[MRAVOutputContext sharedAudioPresentationContext]_block_invoke
我编写以下代码。
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if collectionView == self.video_collectionview
{
// For videoCollectionView
let videocell = collectionView.dequeueReusableCell(withReuseIdentifier: "VideoCollectionViewCell", for: indexPath)as! VideoCollectionViewCell
videocell.videotitle.text = videotitle[indexPath.row]
videocell.videotime.text = videotime[indexPath.row]
let myVideoURL = videourls[indexPath.row]
videocell.videoview.loadVideoURL(myVideoURL as URL)
// videocell.videoview.layer.cornerRadius = 15
return videocell
}
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if collectionView == video_collectionview
{
let videocell = collectionView.dequeueReusableCell(withReuseIdentifier: "VideoCollectionViewCell", for: indexPath)as! VideoCollectionViewCell
let myVideoURL = videourls[indexPath.row]
videocell.videoview.loadVideoURL(myVideoURL as URL)
}
}
【问题讨论】: