3

A screen show short video using AVPlayer in my IOS app. I leave and re-enter this screen few times successfully but after seven times and more I get blank screen and AVPlayerLayer's IsReadyForDisplay property is 'NO'.

I pause AVPlayer(and set to nil) and remove AVPlayerLayer from view's layer when I leave this screen . It seem to me that it not memory use issue(17Mb usage).

I think the problem is AVPlayer buffer or maybe other component that cause a block that way AVPlayer can't read from video file , but I didn't find any way to clean/or clear this buffer/block.

Is anyone had this problem before?Or know why do i get this blank screen in seventh entrance?

Thanks in advance,

Eli

Eli Mal
  • 31
  • 3
  • Did you manage to solve this issue? We are fighting absolutely the same issue now, would appreciate for any info! – Vadim Popov Jan 24 '17 at 19:55

1 Answers1

2

From my experience, that can happen when you have views with variable layerClass overriden and somehow it doesn't get wiped out from the memory and each time that you visit your VC with video layers it will get only worse.

Instead of overriding your VideoView layerClass property, try to insert your video layers manually, by insertSublayer.

Than in the viewDidDisappear try to call removeFromSuperView on all of them and force them to become nil to make sure that everything connected to them will be cleaned from memory.

Maybe it's not the most "right" and the perfect way to do that, but in the end as for visual appearance there were no changes for me.

Also I would like to know what the real cause is because reading all the Apple's documentation didn't help.

Jan
  • 184
  • 2
  • 15