MPMoviePlayer - subview / overlay disappears after a repeat / loop

I am adding subview / overlay starting with a sample MediaPlayer project. The difference is that I'm trying to execute a loop using the following code in the moviePlaybackDidFinish notification:

moviePlayer.initialPlaybackTime = -1.0;
[moviePlayer play];

This strange property initialPlaybackTime prevents the video from flickering in subsequent cycles. If anyone has a better idea, let me know.

There is some kind of race condition in the moviePlaybackDidFinish notification. If I try to re-add the subview directly after the " [moviePlayer play]", nothing will happen. After going through the code, it looks like subview still exists until the playback message is sent, but disappears when the video starts playing.

Does anyone have an idea how I can re-add subview on subsequent loops? Is there a way to discover that subview is still a subtitle of its supervisor? If so, what would be the best way to do this in this scenario?

Thank you for your help.

+3
source share

Source: https://habr.com/ru/post/1715383/


All Articles