AVplayer 在 2-3 次后未显示在 ScrollView 中
我在滚动视图中添加多个 AVPlayer 对象。第一次工作正常,但是当我返回到之前的视图并再次返回时,我无法在滚动视图中看到 AVPlayer 对象。
我需要多个 AVPlayer 的矩阵来显示我的视频的缩略图。
请尽快帮助我
提前致谢。
I am adding multiple AVPlayer objects in a scrollview. For the first time this is working fine but as i go back to my previous view and come back again i am not able to see AVPlayer objects in scrollView.
I need as matrix of multiple AVPlayer to show thumbnails of my videos.
Please help me asap
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了类似的问题,经过大量搜索发现 AVPLayerItem 对象导致了这个问题。
基本上,当 AVPlayer 项目离开屏幕时,您需要确保所有内容都已正确释放,然后当它们返回屏幕时重新创建所有内容。
作为发布过程的一部分,请添加以下行:
That sorted a veryimilar issues for me.
I had a similar problem and after a lot of searching discovered that the AVPLayerItem object causes this issue.
Basically when the AVPlayer items go offscreen you need to make sure everything is released properly, and then recreate everything when they come back on screen.
As part of the release process, include the line:
That sorted a very similar issue for me.
也解决了我无法立即释放当前播放器项目的问题。 (无法手动执行此操作,因为它由班级保留..)
also solves my problem of cannot releasing current player item immediately. (can't manually do that because it's retained by the class..)
以下是如何让 10 个 AVPlayer 在同一个滚动视图内同时播放,每次滚动时:
这是 AppDelegate 实现文件:
这是您唯一需要的两个文件;没有 NIB/XIB。
Here's how you get 10 AVPlayers to play simultaneously, inside the same scrollView, each and every time you scroll it:
Here's the AppDelegate implementation file:
These are the only two files you need; no NIB/XIB.