Closed KeeleyYu closed 1 year ago
Could you update to the latest version of AVPro please Which device(s) have you tested? Which iOS version(s) have you tested? Have you tested it in a new scene using the mediaplayer component?
Great, please let me know how it goes after you have done 1 and 3, thanks :)
I have tested both 1 and 3. Still got the bug :( And I found that if the interval between switching foreground and background is short enough, no matter whether the video got stuck, it will play again. Oppositely, it will get stuck. Is there any inspiration ?
I have disabled the macro in the first line of MediaPlayer_AppFocus for testing. As seen from the log, when switching back to the app from background, it did run Control.Play(), yet without actually play. I haven't look deep into this but, is it related to the AppleMediaplayer + Native ?
- Since I dynamically create the MediaPlayer component through code, I can't check the "Resume playback on audio session route change" checkbox directly through the editor. Instead, I set the 'm_mediaPlayer.PlatformOptionsIOS.flags' to 'ResumeMediaPlaybackAfterAudioSessionRouteChange' by code before video playback, but it doesn't seem to work (video will not resume when headphone connect/disconnect). How can I solve this ?
This part of the issue has been fixed and will make it into the next release.
When the app goes to the background while a video is playing, it pauses like it should. But when the app regains focus, the video does not resume playing on iOS only.
Unfortunately a fix provided for pausing playback when the control centre was opened prevented playback from resuming when an application was returned from the background. This is now fixed and will make it into the next release.
@MorrisRH Awesome, that really helps a lot!! If the next release not that soon, can I implement the fix by myself in somewhere ?
We're planning to get the next release out later this week. The fix is in the native part of the code so there is nothing you can do. A possible workaround would be to call play after a short delay when returning from the background.
Appreciate ! I'm looking forward to it :)
The latest version has been released. Please let us know if it does not fix your issue.
Thanks for swift release! It seems that the bug has been fixed since I have done a couple of test. I will do more testing and developing based on it :) @Chris-RH
One more weird IOS bug here. When switching back from background, the video will more likely start from a certain frame if the interval is larger than around 1s, without continue from the frame that switching to background. Seems that the player record a wrong frame in an early time, leading that the video more likely revert to it Please have a check too :) @Chris-RH
The player jumps back to the previous key-frame, afraid there is nothing we can do about this
The player jumps back to the previous key-frame, afraid there is nothing we can do about this
How can I get the key-frame? Or can I set it when monitoring application switching?
Key-frames are complete frames in the movie file so do not need additional frames being stored in order to decode. When the application goes to the background the partial frames are discarded to reduce memory pressure on the system which is why when the app returns to the foreground it resumes from the last key-frame.
If you really want to try and work around this then you could store the current time when the app goes into the background, and seek to it when focus is restored. There will most likely be a jump though.
Yep I have already tried this way and fixed it at all. Thanks for your explanation as well 👍
Hi, When the app goes to the background while a video is playing, it pauses like it should. But when the app regains focus, the video does not resume playing on iOS only. The app is still running fine. The other functions of app are good as well. It doesn't happen all of the time but it's likely to happen if you go all the way back to the os, tap some other things. Also, it occasionally happens when airpods connected or disconnected. Yet, it works on android and windows.
I have checked the answer for issues #1261, #447 and #91, and I still have some questions as follows:
MediaPlayer_AppFocus.cs is not work on IOS, because of this reason (https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/1261#issuecomment-1260534127). So I guess there is some ‘natural mechanism’ on IOS which seems not work at all. Even though I remove the UNITY_IOS macro from the #if defines, it still get stuck occasionally. Is it because that ‘Control.Pause()’ only works on non-ios platform? If so or not, how can I fix this problem ?
Since I dynamically create the MediaPlayer component through code, I can't check the "Resume playback on audio session route change" checkbox directly through the editor. Instead, I set the 'm_mediaPlayer.PlatformOptionsIOS.flags' to 'ResumeMediaPlaybackAfterAudioSessionRouteChange' by code before video playback, but it doesn't seem to work (video will not resume when headphone connect/disconnect). How can I solve this ?
Your Setup (please complete the following information): Unity version: 2020.3.25f1 AVPro Video version (number and edition (trial/core/ultra/enterprise)): ultra Operating system version: v2.6.6 Device model: ios Video specs (resolution, frame-rate, codec, file size): none