capacitor-plugin-playlist 0.9.3 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CapacitorPluginPlaylist.podspec +1 -1
  2. package/dist/esm/RmxAudioPlayer.d.ts +1 -1
  3. package/ios/Plugin/Plugin.swift +8 -12
  4. package/ios/Plugin/RmxAudioPlayer.swift +36 -10
  5. package/ios/Plugin.xcodeproj/project.pbxproj +4 -4
  6. package/ios/Podfile +11 -1
  7. package/ios/Podfile.lock +22 -0
  8. package/ios/Pods/Local Podspecs/Capacitor.podspec.json +32 -0
  9. package/ios/Pods/Local Podspecs/CapacitorCordova.podspec.json +31 -0
  10. package/ios/Pods/Manifest.lock +22 -0
  11. package/ios/Pods/Pods.xcodeproj/project.pbxproj +1641 -0
  12. package/ios/Pods/Pods.xcodeproj/xcuserdata/philippmohrenweiser.xcuserdatad/xcschemes/Capacitor-Capacitor.xcscheme +58 -0
  13. package/ios/Pods/Pods.xcodeproj/xcuserdata/philippmohrenweiser.xcuserdatad/xcschemes/Capacitor.xcscheme +58 -0
  14. package/ios/Pods/Pods.xcodeproj/xcuserdata/philippmohrenweiser.xcuserdatad/xcschemes/CapacitorCordova-CapacitorCordova.xcscheme +58 -0
  15. package/ios/Pods/Pods.xcodeproj/xcuserdata/philippmohrenweiser.xcuserdatad/xcschemes/CapacitorCordova.xcscheme +58 -0
  16. package/ios/Pods/Pods.xcodeproj/xcuserdata/philippmohrenweiser.xcuserdatad/xcschemes/Pods-Plugin.xcscheme +58 -0
  17. package/ios/Pods/Pods.xcodeproj/xcuserdata/philippmohrenweiser.xcuserdatad/xcschemes/Pods-PluginTests.xcscheme +58 -0
  18. package/ios/Pods/Pods.xcodeproj/xcuserdata/philippmohrenweiser.xcuserdatad/xcschemes/xcschememanagement.plist +41 -0
  19. package/ios/Pods/Target Support Files/Capacitor/Capacitor-Info.plist +26 -0
  20. package/ios/Pods/Target Support Files/Capacitor/Capacitor-dummy.m +5 -0
  21. package/ios/Pods/Target Support Files/Capacitor/Capacitor-prefix.pch +12 -0
  22. package/ios/Pods/Target Support Files/Capacitor/Capacitor.debug.xcconfig +16 -0
  23. package/ios/Pods/Target Support Files/Capacitor/Capacitor.modulemap +8 -0
  24. package/ios/Pods/Target Support Files/Capacitor/Capacitor.release.xcconfig +16 -0
  25. package/ios/Pods/Target Support Files/Capacitor/ResourceBundle-Capacitor-Capacitor-Info.plist +24 -0
  26. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-Info.plist +26 -0
  27. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-dummy.m +5 -0
  28. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-prefix.pch +12 -0
  29. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.debug.xcconfig +13 -0
  30. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.modulemap +6 -0
  31. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.release.xcconfig +13 -0
  32. package/ios/Pods/Target Support Files/CapacitorCordova/ResourceBundle-CapacitorCordova-CapacitorCordova-Info.plist +24 -0
  33. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-Info.plist +26 -0
  34. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.markdown +53 -0
  35. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.plist +91 -0
  36. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-dummy.m +5 -0
  37. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-umbrella.h +16 -0
  38. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.debug.xcconfig +15 -0
  39. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.modulemap +6 -0
  40. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.release.xcconfig +15 -0
  41. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-Info.plist +26 -0
  42. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.markdown +53 -0
  43. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.plist +91 -0
  44. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-dummy.m +5 -0
  45. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh +188 -0
  46. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-umbrella.h +16 -0
  47. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.debug.xcconfig +16 -0
  48. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.modulemap +6 -0
  49. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig +16 -0
  50. package/package.json +2 -3
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '15.0'
14
+ s.ios.deployment_target = '18.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.3'
17
17
  end
@@ -15,7 +15,7 @@ export declare class RmxAudioPlayer {
15
15
  * because they properly interpret the range of these values, but this field is exposed if you wish to observe
16
16
  * or interrogate it.
17
17
  */
18
- get currentState(): "error" | "stopped" | "unknown" | "paused" | "loading" | "playing" | "ready";
18
+ get currentState(): "unknown" | "ready" | "error" | "playing" | "loading" | "paused" | "stopped";
19
19
  get currentTrack(): AudioTrack | null;
20
20
  /**
21
21
  * If the playlist is currently playling a track.
@@ -119,9 +119,8 @@ public class PlaylistPlugin: CAPPlugin, StatusUpdater {
119
119
  do {
120
120
  try audioPlayerImpl.playTrack(index: index, positionTime: call.getFloat("position"))
121
121
  call.resolve();
122
- }
123
- catch let message {
124
- call.reject(message as! String)
122
+ } catch {
123
+ call.reject(error.localizedDescription)
125
124
  }
126
125
  }
127
126
  @objc func playTrackById(_ call: CAPPluginCall) {
@@ -133,9 +132,8 @@ public class PlaylistPlugin: CAPPlugin, StatusUpdater {
133
132
  do {
134
133
  try audioPlayerImpl.playTrack(id, positionTime: call.getFloat("position"))
135
134
  call.resolve();
136
- }
137
- catch let message {
138
- call.reject(message as! String)
135
+ } catch {
136
+ call.reject(error.localizedDescription)
139
137
  }
140
138
  }
141
139
  @objc func selectTrackByIndex(_ call: CAPPluginCall) {
@@ -147,9 +145,8 @@ public class PlaylistPlugin: CAPPlugin, StatusUpdater {
147
145
  do {
148
146
  try audioPlayerImpl.selectTrack(index: index)
149
147
  call.resolve();
150
- }
151
- catch let message {
152
- call.reject(message as! String)
148
+ } catch {
149
+ call.reject(error.localizedDescription)
153
150
  }
154
151
  }
155
152
  @objc func selectTrackById(_ call: CAPPluginCall) {
@@ -161,9 +158,8 @@ public class PlaylistPlugin: CAPPlugin, StatusUpdater {
161
158
  do {
162
159
  try audioPlayerImpl.selectTrack(id: id)
163
160
  call.resolve();
164
- }
165
- catch let message {
166
- call.reject(message as! String)
161
+ } catch {
162
+ call.reject(error.localizedDescription)
167
163
  }
168
164
  }
169
165
  @objc func setPlaybackVolume(_ call: CAPPluginCall) {
@@ -12,7 +12,34 @@ import Capacitor
12
12
  import MediaPlayer
13
13
  import UIKit
14
14
 
15
- extension String: Error {}
15
+ enum RmxAudioPlayerError: Error, LocalizedError {
16
+ case indexOutOfBounds
17
+ case playlistEmpty
18
+ case trackIdNotFound
19
+ case indexOutOfPlaylistBounds
20
+ case queueEmpty
21
+ case indexNotFound
22
+ case trackNotFoundById(String)
23
+
24
+ var errorDescription: String? {
25
+ switch self {
26
+ case .indexOutOfBounds:
27
+ return "Provided index is out of bounds"
28
+ case .playlistEmpty:
29
+ return "The playlist is empty!"
30
+ case .trackIdNotFound:
31
+ return "Track ID not found"
32
+ case .indexOutOfPlaylistBounds:
33
+ return "Index out of Playlist bounds"
34
+ case .queueEmpty:
35
+ return "Queue is Empty"
36
+ case .indexNotFound:
37
+ return "Index not found"
38
+ case .trackNotFoundById(let id):
39
+ return "Could not find track by id" + id
40
+ }
41
+ }
42
+ }
16
43
 
17
44
  final class RmxAudioPlayer: NSObject {
18
45
 
@@ -163,7 +190,7 @@ final class RmxAudioPlayer: NSObject {
163
190
 
164
191
  func playTrack(index: Int, positionTime: Float?) throws {
165
192
  guard (0..<avQueuePlayer.queuedAudioTracks.count).contains(index) else {
166
- throw "Provided index is out of bounds"
193
+ throw RmxAudioPlayerError.indexOutOfBounds
167
194
  }
168
195
 
169
196
  if avQueuePlayer.currentIndex() != index {
@@ -178,14 +205,14 @@ final class RmxAudioPlayer: NSObject {
178
205
 
179
206
  func playTrack(_ trackId: String, positionTime: Float?) throws {
180
207
  guard !avQueuePlayer.queuedAudioTracks.isEmpty else {
181
- throw "The playlist is empty!"
208
+ throw RmxAudioPlayerError.playlistEmpty
182
209
  }
183
210
 
184
211
  if avQueuePlayer.currentAudioTrack?.trackId != trackId {
185
212
  let result = findTrack(byId: trackId)
186
213
  let idx = result?["index"] as? Int ?? -1
187
214
  guard idx >= 0 else {
188
- throw "Track ID not found"
215
+ throw RmxAudioPlayerError.trackIdNotFound
189
216
  }
190
217
  avQueuePlayer.setCurrentIndex(idx)
191
218
  }
@@ -222,14 +249,14 @@ final class RmxAudioPlayer: NSObject {
222
249
  /// These functions don't really do anything interesting by themselves.
223
250
  func selectTrack(index: Int) throws {
224
251
  guard index >= 0 && index < avQueuePlayer.queuedAudioTracks.count else {
225
- throw "Index out of Playlist bounds"
252
+ throw RmxAudioPlayerError.indexOutOfPlaylistBounds
226
253
  }
227
254
  avQueuePlayer.setCurrentIndex(index)
228
255
  }
229
256
 
230
257
  func selectTrack(id: String) throws {
231
258
  guard !avQueuePlayer.queuedAudioTracks.isEmpty else {
232
- throw "Queue is Empty"
259
+ throw RmxAudioPlayerError.queueEmpty
233
260
  }
234
261
  let result = findTrack(byId: id)
235
262
  let idx = (result?["index"] as? NSNumber)?.intValue ?? 0
@@ -241,7 +268,7 @@ final class RmxAudioPlayer: NSObject {
241
268
 
242
269
  func removeItem(_ index: Int) throws {
243
270
  guard index > -1 && index < avQueuePlayer.queuedAudioTracks.count else {
244
- throw "Index not found"
271
+ throw RmxAudioPlayerError.indexNotFound
245
272
  }
246
273
  let item = avQueuePlayer.queuedAudioTracks[index]
247
274
  removeTrackObservers(item)
@@ -255,7 +282,7 @@ final class RmxAudioPlayer: NSObject {
255
282
  let track = result?["track"] as? AudioTrack
256
283
 
257
284
  guard idx >= 0 else {
258
- throw "Could not find track by id" + id
285
+ throw RmxAudioPlayerError.trackNotFoundById(id)
259
286
  }
260
287
  // AudioTrack* item = [self avQueuePlayer].itemsForPlayer[idx];
261
288
  removeTrackObservers(track)
@@ -536,8 +563,7 @@ final class RmxAudioPlayer: NSObject {
536
563
 
537
564
  switch interruptionType {
538
565
  case AVAudioSession.InterruptionType.began:
539
- let suspended = (interruptionNotification?.userInfo?[AVAudioSessionInterruptionWasSuspendedKey] as? NSNumber)?.boolValue ?? false
540
- print("AVAudioSessionInterruptionTypeBegan. Was suspended: \(suspended)")
566
+ print("AVAudioSessionInterruptionTypeBegan")
541
567
  if avQueuePlayer.isPlaying {
542
568
  wasPlayingInterrupted = true
543
569
  }
@@ -395,7 +395,7 @@
395
395
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
396
396
  GCC_WARN_UNUSED_FUNCTION = YES;
397
397
  GCC_WARN_UNUSED_VARIABLE = YES;
398
- IPHONEOS_DEPLOYMENT_TARGET = 15.0;
398
+ IPHONEOS_DEPLOYMENT_TARGET = 18.0;
399
399
  MTL_ENABLE_DEBUG_INFO = YES;
400
400
  ONLY_ACTIVE_ARCH = YES;
401
401
  SDKROOT = iphoneos;
@@ -449,7 +449,7 @@
449
449
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
450
450
  GCC_WARN_UNUSED_FUNCTION = YES;
451
451
  GCC_WARN_UNUSED_VARIABLE = YES;
452
- IPHONEOS_DEPLOYMENT_TARGET = 15.0;
452
+ IPHONEOS_DEPLOYMENT_TARGET = 18.0;
453
453
  MTL_ENABLE_DEBUG_INFO = NO;
454
454
  SDKROOT = iphoneos;
455
455
  SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -472,7 +472,7 @@
472
472
  DYLIB_INSTALL_NAME_BASE = "@rpath";
473
473
  INFOPLIST_FILE = Plugin/Info.plist;
474
474
  INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
475
- IPHONEOS_DEPLOYMENT_TARGET = 15.0;
475
+ IPHONEOS_DEPLOYMENT_TARGET = 18.0;
476
476
  LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)\n$(FRAMEWORK_SEARCH_PATHS)\n$(FRAMEWORK_SEARCH_PATHS)";
477
477
  ONLY_ACTIVE_ARCH = YES;
478
478
  PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.Plugin;
@@ -497,7 +497,7 @@
497
497
  DYLIB_INSTALL_NAME_BASE = "@rpath";
498
498
  INFOPLIST_FILE = Plugin/Info.plist;
499
499
  INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
500
- IPHONEOS_DEPLOYMENT_TARGET = 15.0;
500
+ IPHONEOS_DEPLOYMENT_TARGET = 18.0;
501
501
  LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)";
502
502
  ONLY_ACTIVE_ARCH = NO;
503
503
  PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.Plugin;
package/ios/Podfile CHANGED
@@ -1,4 +1,4 @@
1
- platform :ios, '15.0'
1
+ platform :ios, '18.0'
2
2
 
3
3
  def capacitor_pods
4
4
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
@@ -14,3 +14,13 @@ end
14
14
  target 'PluginTests' do
15
15
  capacitor_pods
16
16
  end
17
+
18
+ post_install do |installer|
19
+ installer.pods_project.targets.each do |target|
20
+ target.build_configurations.each do |config|
21
+ if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 18.0
22
+ config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '18.0'
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ PODS:
2
+ - Capacitor (8.0.0):
3
+ - CapacitorCordova
4
+ - CapacitorCordova (8.0.0)
5
+
6
+ DEPENDENCIES:
7
+ - "Capacitor (from `../node_modules/@capacitor/ios`)"
8
+ - "CapacitorCordova (from `../node_modules/@capacitor/ios`)"
9
+
10
+ EXTERNAL SOURCES:
11
+ Capacitor:
12
+ :path: "../node_modules/@capacitor/ios"
13
+ CapacitorCordova:
14
+ :path: "../node_modules/@capacitor/ios"
15
+
16
+ SPEC CHECKSUMS:
17
+ Capacitor: 341ff7cf652ec695d1a8ebf604db448ac7b6d635
18
+ CapacitorCordova: 5dc3912d25ef770a3fe0f431bb65c9fbfa2e92f9
19
+
20
+ PODFILE CHECKSUM: 4088beb76fba1276dbeb50750c4d9a4b9f5821f2
21
+
22
+ COCOAPODS: 1.16.2
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "Capacitor",
3
+ "version": "8.0.0",
4
+ "summary": "Capacitor for iOS",
5
+ "license": "MIT",
6
+ "homepage": "https://capacitorjs.com/",
7
+ "platforms": {
8
+ "ios": "15.0"
9
+ },
10
+ "authors": {
11
+ "Ionic Team": "hi@ionicframework.com"
12
+ },
13
+ "source": {
14
+ "git": "https://github.com/ionic-team/capacitor.git",
15
+ "tag": "8.0.0"
16
+ },
17
+ "source_files": "Capacitor/Capacitor/**/*.{swift,h,m}",
18
+ "module_map": "Capacitor/Capacitor/Capacitor.modulemap",
19
+ "resources": [
20
+ "Capacitor/Capacitor/assets/native-bridge.js"
21
+ ],
22
+ "resource_bundles": {
23
+ "Capacitor": [
24
+ "Capacitor/Capacitor/PrivacyInfo.xcprivacy"
25
+ ]
26
+ },
27
+ "dependencies": {
28
+ "CapacitorCordova": []
29
+ },
30
+ "swift_versions": "5.1",
31
+ "swift_version": "5.1"
32
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "CapacitorCordova",
3
+ "module_name": "Cordova",
4
+ "version": "8.0.0",
5
+ "summary": "Capacitor Cordova Compatibility Layer",
6
+ "homepage": "https://capacitorjs.com",
7
+ "license": "MIT",
8
+ "authors": {
9
+ "Ionic Team": "hi@ionicframework.com"
10
+ },
11
+ "source": {
12
+ "git": "https://github.com/ionic-team/capacitor",
13
+ "tag": "8.0.0"
14
+ },
15
+ "platforms": {
16
+ "ios": "15.0"
17
+ },
18
+ "source_files": "CapacitorCordova/CapacitorCordova/**/*.{h,m}",
19
+ "public_header_files": [
20
+ "CapacitorCordova/CapacitorCordova/Classes/Public/*.h",
21
+ "CapacitorCordova/CapacitorCordova/CapacitorCordova.h"
22
+ ],
23
+ "module_map": "CapacitorCordova/CapacitorCordova/CapacitorCordova.modulemap",
24
+ "resource_bundles": {
25
+ "CapacitorCordova": [
26
+ "CapacitorCordova/CapacitorCordova/PrivacyInfo.xcprivacy"
27
+ ]
28
+ },
29
+ "requires_arc": true,
30
+ "frameworks": "WebKit"
31
+ }
@@ -0,0 +1,22 @@
1
+ PODS:
2
+ - Capacitor (8.0.0):
3
+ - CapacitorCordova
4
+ - CapacitorCordova (8.0.0)
5
+
6
+ DEPENDENCIES:
7
+ - "Capacitor (from `../node_modules/@capacitor/ios`)"
8
+ - "CapacitorCordova (from `../node_modules/@capacitor/ios`)"
9
+
10
+ EXTERNAL SOURCES:
11
+ Capacitor:
12
+ :path: "../node_modules/@capacitor/ios"
13
+ CapacitorCordova:
14
+ :path: "../node_modules/@capacitor/ios"
15
+
16
+ SPEC CHECKSUMS:
17
+ Capacitor: 341ff7cf652ec695d1a8ebf604db448ac7b6d635
18
+ CapacitorCordova: 5dc3912d25ef770a3fe0f431bb65c9fbfa2e92f9
19
+
20
+ PODFILE CHECKSUM: 4088beb76fba1276dbeb50750c4d9a4b9f5821f2
21
+
22
+ COCOAPODS: 1.16.2