I have an AVPlayerViewController object with an AVPlayer that loads a URL local to the app. Sometimes, when I put the app into the background, there's a chance that the content will disappear the next time I restore the app to the foreground. When I check the readyForDisplay property after it disappears, it returns false.
Has anyone seen this happen before? Is it possible to prevent the player from disappearing, and if so, then how do I do it? I already tried removing the AVPlayer from the AVPlayerViewController when the app went into the background, and restoring it when it came back, as specified in this tech note, but that didn't work.
I figured it out. In case anyone else runs into this problem, it turned out to be the AVPlayer object's actionAtItemEnd. If it's set to none (AVPlayerActionAtItemEndNone), then the video disappears when the app is brought back to the foreground. But if it's set to pause (AVPlayerActionAtItemEndPause), then the final frame of the video stays on the screen when the app is brought back to the foreground.