From 394363c8cb6c91e9a493c6ebd6de8930de134121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rasmus=20Kr=C3=A4mer?= Date: Sat, 30 Apr 2022 10:58:08 +0200 Subject: [PATCH] Send report when playback ends --- ios/App/App.xcodeproj/project.pbxproj | 6 +++--- ios/App/Shared/player/AudioPlayer.swift | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index 9859b22d..4df66f67 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -460,13 +460,13 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 6; - DEVELOPMENT_TEAM = 7UFJ7D8V6A; + DEVELOPMENT_TEAM = N8AA4S3S96; INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MARKETING_VERSION = 0.9.43; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; - PRODUCT_BUNDLE_IDENTIFIER = com.audiobookshelf.app.development; + PRODUCT_BUNDLE_IDENTIFIER = com.audiobookshelf.app.dev; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OBJC_BRIDGING_HEADER = "App/App-Bridging-Header.h"; @@ -484,7 +484,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 6; - DEVELOPMENT_TEAM = 7UFJ7D8V6A; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; diff --git a/ios/App/Shared/player/AudioPlayer.swift b/ios/App/Shared/player/AudioPlayer.swift index d088400e..52e2b886 100644 --- a/ios/App/Shared/player/AudioPlayer.swift +++ b/ios/App/Shared/player/AudioPlayer.swift @@ -60,6 +60,7 @@ class AudioPlayer: NSObject { playerItem.addObserver(self, forKeyPath: #keyPath(AVPlayerItem.status), options: .new, context: &playerItemContext) self.audioPlayer.replaceCurrentItem(with: playerItem) + seek(playbackSession.currentTime) NSLog("Audioplayer ready") } @@ -155,7 +156,6 @@ class AudioPlayer: NSObject { } self.rate = rate - self.updateNowPlaying() } @@ -258,14 +258,11 @@ class AudioPlayer: NSObject { if playerStatus == .readyToPlay { self.updateNowPlaying() - let firstReady = self.status < 0 self.status = 0 if self.playWhenReady { seek(playbackSession.currentTime) self.playWhenReady = false self.play() - } else if (firstReady) { // Only seek on first readyToPlay - seek(playbackSession.currentTime) } } } @@ -273,6 +270,7 @@ class AudioPlayer: NSObject { if keyPath == #keyPath(AVPlayer.rate) { self.setPlaybackRate(change?[.newKey] as? Float ?? 1.0, observed: true) } else if keyPath == #keyPath(AVPlayer.currentItem) { + NotificationCenter.default.post(name: NSNotification.Name(PlayerEvents.update.rawValue), object: nil) NSLog("WARNING: Item ended") } } else {