Open sy6sy2 opened 5 years ago
Overall I agree. Comments:
applicationWillResignActive
(like in the flowchart)applicationDidEnterBackground
(like in the flowchart)applicationWillResignActive
, needs testingapplicationDidEnterBackground
, needs testingOne point I'd alter:
applicationDidEnterBackground
- A "network" file is played --> Stop it
I'd rather pause it, as user might return to the app fast enough. Then in this case on applicationWillEnterForeground
we can check if a significant amount of time has passed (maybe possible to fetch timeout), in which case we reload the stream from network (as if it was stop -> play).
One more case to test: user selects something from top shelf after applicationDidEnterBackground
--> either stop player and open movie details or replace currently playing item.
P.S. Pausing on applicationWillResignActive
must save current time offset.
Thank you for your comments, I updated the first post.
User select item from TopShelf
should be: applicationWillEnterForeground, applicationDidBecomeActive (normal app resume process)
Wake up Apple TV with Kodi app as last open app
the second applicationWillResignActive followed by applicationDidBecomeActive looks strange. Are you sure there were no interruptions like some system dialog?
I found this strange too :-/ I will try again just to be sure.
I tried again and I can confirm the "strange" transition when you put the device to sleep while Kodi is running.
This week I will try to have a look to this improvement. I think that I will try to do like Android --> https://github.com/xbmc/xbmc/pull/17187
Don't forget when tvos screensaver is up. You will get pushed into the background but tvOS will not schedule possible suspend in 5 seconds.
A thread to discuss the wanted behavior of Kodi when the Apple TV change states.
WIP work
Branch: https://github.com/SylvainCecchetto/xbmc/tree/transition-management
Actuel behavior:
Future work:
Examples of transitions (tested)
App switcher:
applicationWillResignActive
applicationDidBecomeActive
Siri:
applicationWillResignActive
applicationDidBecomeActive
Springboard:
applicationWillResignActive
thenapplicationDidEnterBackground
applicationWillEnterForeground
thenapplicationDidBecomeActive
TopShelf:
applicationWillEnterForeground
thenapplicationDidBecomeActive
Control Center:
applicationWillResignActive
applicationDidBecomeActive
Sleep:
applicationDidBecomeActive
thenapplicationWillResignActive
thenapplicationDidEnterBackground
applicationWillEnterForeground
thenapplicationDidBecomeActive
thenapplicationWillResignActive
thenapplicationDidBecomeActive
Possible states of Kodi when a "transition" appears
Suggestions
applicationWillResignActive
applicationDidEnterBackground
We have 5 seconds, instead tvOS will terminate KodiapplicationDidBecomeActive
applicationDidFinishLaunching
It's quite possible (sure) that I made mistakes, please tell me if I'm wrong ;-).
What do you think? Let me know your opinion and I will update this post :-D
Source: https://stackoverflow.com/questions/16880791/is-applicationwillresignactive-ever-called-before-didfinishlaunchingwithoptions