diff --git a/Sources/App/iOS/VLCAppDelegate.m b/Sources/App/iOS/VLCAppDelegate.m index 8f0f23a0d91baac3fca0a1c631e61f0688d60e3e..d9b42c2b25c27d4cc9b257bf2bbffe9e2042afe8 100644 --- a/Sources/App/iOS/VLCAppDelegate.m +++ b/Sources/App/iOS/VLCAppDelegate.m @@ -2,7 +2,7 @@ * VLCAppDelegate.m * VLC for iOS ***************************************************************************** - * Copyright (c) 2013-2022 VideoLAN. All rights reserved. + * Copyright (c) 2013-2023 VideoLAN. All rights reserved. * $Id$ * * Authors: Felix Paul Kühne <fkuehne # videolan.org> @@ -229,6 +229,16 @@ } } +- (void)applicationWillTerminate:(UIApplication *)application +{ + /* save the playback position before the user kills the app */ + VLCPlaybackService *vps = [VLCPlaybackService sharedInstance]; + if (vps.isPlaying || vps.playerIsSetup) { + VLCAppCoordinator *appCoordinator = [VLCAppCoordinator sharedInstance]; + [appCoordinator.mediaLibraryService savePlaybackStateFrom:vps]; + } +} + - (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler { [[VLCAppCoordinator sharedInstance] handleShortcutItem:shortcutItem];