Home  >  Q&A  >  body text

ios - 我用AVPlayer播放本地视频在切换前后台状态的时候有几率会先出现启动图片再跳回播放界面是为啥?

播放视频中,切换前后台状态出现的异常现象

PHP中文网PHP中文网2741 days ago304

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 09:36:31

    This is normal. If a task does not end in time when switching to the background, the previous screenshot or startup screen will be displayed when you return to the app. The system will take a screenshot of the current app interface when it is placed in the background. However, if the app has other tasks that have not been completed or the video interface will cause the system to fail to take a screenshot, the startup screen will be displayed the next time it is activated. This is system behavior, and there are no rules to follow, so you think it is an abnormal situation.
    If you want to prevent this situation, please check your app and pause or end all tasks when applicationWillResignActive, such as network requests, recording and playing audio and video, various background threads, etc. Of course, this cannot 100% guarantee that the system's screenshots will work properly. Some tasks will take time to pause, which will also cause the screenshots to fail.

    reply
    0
  • Cancelreply