AVPlayer crashes after multiple playbacks-

前端 未结 2 1634
面向向阳花
面向向阳花 2021-02-05 16:35

I\'m trying to create an app which plays videos from a file using AVFoundation. The videos are shown in a view accessed by tapping on a row in a parent tableview.

相关标签:
2条回答
  • 2021-02-05 16:47

    May be you leave your videoView retained in some place? Because if you do, your avPlayerItem and avPlayer stay alive and according to this topic you came up to iOS limitation for "render pipeline" with 4 videos staying in memory.

    Remember that setting var to nil does not actually release underlying object. So your

    videoView = nil;
    

    can have zero effect.

    0 讨论(0)
  • 2021-02-05 17:09

    You should remove from superview first as it will reduce the retain count by 1 and ARC will take care of the release for your code.

    like this

    [videoView removeFromSuperview];
    [self setVideoView:nil];
    
    0 讨论(0)
提交回复
热议问题