AVplayer完全删除视频内存不足
我知道 Stackoverflow 上有一些关于这个问题的提示,但我还没有找到对我的问题非常满意的答案。
我想从内存中完全删除 AVPlayerLayer 类中使用 AVPlayer 播放的视频。我读过您实际上不允许调用包含 AVPlayerLayer 的类的 dealloc 。但即使我这样做,视频仍然保留在内存中(cfr 声音不会停止播放)。
有些人暗示您应该暂停播放器,或者只是加载一个新视频,但我希望它消失...
我需要这个,因为旋转设备时,我希望视频从内存中踢出,并加载一个新视频新的方向。我需要完全销毁视频,因为它所在的父视图也需要被销毁。
结构
这是我的UIView 的 -> UI滚动视图 -> UIviewWithPlayer -> AVPlayerLayer
在 UIscrollView 中,我在 UIViewWithPlayer 上调用release和removefromsuperview。在 UIviewWithPlayer 中,我在 AVPlayerLayer 上调用release和removefromsuperview。但这似乎不起作用。
预先非常感谢您的帮助。
I know there have been a few hints on Stackoverflow about this issue but I haven't found a very satisfying answer to my problem.
I want to completely remove a video playing with AVPlayer in an AVPlayerLayer class from memory. I have read your are actually not allowed to call dealloc of the class containing the AVPlayerLayer. But even when I do so, the video remains in memory (cfr the sound does not stop playing).
Some people hint that you should pause the player, or just load in a new video, but I want it gone...
I need this because when rotating the device, I want the video kicked out of memory and a new video loaded in for the new orientation. I need to destroy the video completely because the parent view it is in also needs to be destroyed.
This is the structure I have
UIView
-> UIScrollView
-> UIviewWithPlayer
->AVPlayerLayer
In UIscrollView I call release and removefromsuperview on UIViewWithPlayer. In UIviewWithPlayer I call release and removefromsuperview on AVPlayerLayer. But that does not seem to work.
Thank you very much in advance for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论