capacitor-plugin-playlist 0.4.2 → 0.5.1

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.
@@ -6,13 +6,13 @@ ext {
6
6
  }
7
7
 
8
8
  buildscript {
9
- ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.8.20'
9
+ ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.10'
10
10
  repositories {
11
11
  google()
12
12
  mavenCentral()
13
13
  }
14
14
  dependencies {
15
- classpath 'com.android.tools.build:gradle:8.0.0'
15
+ classpath 'com.android.tools.build:gradle:8.2.1'
16
16
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
17
17
  }
18
18
  }
@@ -22,10 +22,10 @@ apply plugin: 'kotlin-android'
22
22
 
23
23
  android {
24
24
  namespace "org.dwbn.plugins.playlist"
25
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
25
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
26
26
  defaultConfig {
27
27
  minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
28
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
28
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
29
29
  versionCode 1
30
30
  versionName "1.0"
31
31
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -1,6 +1,7 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
4
4
  networkTimeout=10000
5
+ validateDistributionUrl=true
5
6
  zipStoreBase=GRADLE_USER_HOME
6
7
  zipStorePath=wrapper/dists
@@ -85,9 +85,6 @@ done
85
85
  APP_BASE_NAME=${0##*/}
86
86
  APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
87
87
 
88
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89
- DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90
-
91
88
  # Use the maximum available, or set MAX_FD != -1 to use that value.
92
89
  MAX_FD=maximum
93
90
 
@@ -133,10 +130,13 @@ location of your Java installation."
133
130
  fi
134
131
  else
135
132
  JAVACMD=java
136
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
133
+ if ! command -v java >/dev/null 2>&1
134
+ then
135
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137
136
 
138
137
  Please set the JAVA_HOME variable in your environment to match the
139
138
  location of your Java installation."
139
+ fi
140
140
  fi
141
141
 
142
142
  # Increase the maximum file descriptors if we can.
@@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
197
197
  done
198
198
  fi
199
199
 
200
+
201
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
202
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
203
+
200
204
  # Collect all arguments for the java command;
201
205
  # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202
206
  # shell script including quotes and variable substitutions, so put them in
@@ -17,14 +17,15 @@ class App : Application() {
17
17
  private lateinit var _playlistManager: PlaylistManager;
18
18
  val playlistManager get() = _playlistManager
19
19
 
20
- fun initPlaylistManager() {
20
+ fun resetPlaylistManager() {
21
21
  _playlistManager = PlaylistManager(this)
22
22
  }
23
23
 
24
24
  override fun onCreate() {
25
+ resetPlaylistManager()
25
26
  super.onCreate()
26
27
 
27
- //configureExoMedia()
28
+ configureExoMedia()
28
29
  }
29
30
 
30
31
  private fun configureExoMedia() {
@@ -17,23 +17,19 @@ class PlaylistPlugin : Plugin(), OnStatusReportListener {
17
17
  private var resetStreamOnPause = true
18
18
 
19
19
  override fun load() {
20
- return;
21
20
  audioPlayerImpl = RmxAudioPlayer(this, (this.context.applicationContext as App))
22
21
  }
23
22
 
24
23
  @PluginMethod
25
24
  fun initialize(call: PluginCall) {
26
- call.resolve()
27
- return;
28
25
  statusCallback = OnStatusCallback(this)
29
26
  onStatus(RmxAudioStatusMessage.RMXSTATUS_REGISTER, "INIT", null)
30
27
  Log.i(TAG, "Initialized...")
31
28
  audioPlayerImpl!!.resume()
29
+ call.resolve()
32
30
  }
33
31
  @PluginMethod
34
32
  fun setOptions(call: PluginCall) {
35
- call.resolve()
36
- return;
37
33
  val options: JSObject = call.getObject("options") ?: JSObject()
38
34
  resetStreamOnPause = options.optBoolean("resetStreamOnPause", this.resetStreamOnPause)
39
35
  Log.i("AudioPlayerOptions", options.toString())
@@ -44,8 +40,6 @@ class PlaylistPlugin : Plugin(), OnStatusReportListener {
44
40
 
45
41
  @PluginMethod
46
42
  fun release(call: PluginCall) {
47
- call.resolve()
48
- return;
49
43
  destroyResources()
50
44
  call.resolve()
51
45
  Log.i(TAG,"released")
@@ -53,8 +47,6 @@ class PlaylistPlugin : Plugin(), OnStatusReportListener {
53
47
 
54
48
  @PluginMethod
55
49
  fun setLoop(call: PluginCall) {
56
- call.resolve()
57
- return;
58
50
  val loop: Boolean = call.getBoolean("loop", audioPlayerImpl!!.playlistManager.loop)!!
59
51
  audioPlayerImpl!!.playlistManager.loop = loop
60
52
  call.resolve()
@@ -63,8 +55,6 @@ class PlaylistPlugin : Plugin(), OnStatusReportListener {
63
55
 
64
56
  @PluginMethod
65
57
  fun setPlaylistItems(call: PluginCall) {
66
- call.resolve()
67
- return;
68
58
  val items: JSArray = call.getArray("items")
69
59
  val optionsArgs: JSONObject = call.getObject("options")
70
60
  val options = PlaylistItemOptions(optionsArgs)
@@ -84,12 +74,10 @@ class PlaylistPlugin : Plugin(), OnStatusReportListener {
84
74
 
85
75
  @PluginMethod
86
76
  fun addItem(call: PluginCall) {
87
- call.resolve()
88
- return;
89
77
  val item: JSONObject = call.getObject("item")
90
78
  val playerItem: AudioTrack? = getTrackItem(item)
91
79
  audioPlayerImpl!!.getPlaylistManager().addItem(playerItem)
92
- x
80
+
93
81
 
94
82
  if (playerItem?.trackId != null) {
95
83
  onStatus(RmxAudioStatusMessage.RMXSTATUS_ITEM_ADDED, playerItem.trackId, playerItem.toDict())
@@ -100,8 +88,6 @@ x
100
88
 
101
89
  @PluginMethod
102
90
  fun addAllItems(call: PluginCall) {
103
- call.resolve()
104
- return;
105
91
  val items: JSONArray = call.getArray("items")
106
92
  val trackItems = getTrackItems(items)
107
93
  audioPlayerImpl!!.playlistManager.addAllItems(trackItems)
@@ -117,8 +103,6 @@ x
117
103
 
118
104
  @PluginMethod
119
105
  fun removeItem(call: PluginCall) {
120
- call.resolve()
121
- return;
122
106
  val trackIndex: Int = call.getInt("index", -1)!!
123
107
  val trackId: String = call.getString("id", "")!!
124
108
  Log.i(TAG,"removeItem trackIn" )
@@ -135,8 +119,6 @@ x
135
119
 
136
120
  @PluginMethod
137
121
  fun removeItems(call: PluginCall) {
138
- call.resolve()
139
- return;
140
122
  val items: JSONArray = call.getArray("items")
141
123
  var removed = 0
142
124
 
@@ -164,8 +146,6 @@ x
164
146
 
165
147
  @PluginMethod
166
148
  fun clearAllItems(call: PluginCall) {
167
- call.resolve()
168
- return;
169
149
  audioPlayerImpl!!.playlistManager.clearItems()
170
150
 
171
151
  onStatus(RmxAudioStatusMessage.RMXSTATUS_PLAYLIST_CLEARED, "INVALID", null)
@@ -176,8 +156,6 @@ x
176
156
 
177
157
  @PluginMethod
178
158
  fun play(call: PluginCall) {
179
- call.resolve()
180
- return;
181
159
  if (audioPlayerImpl!!.playlistManager.playlistHandler != null) {
182
160
  val isPlaying = (audioPlayerImpl!!.playlistManager.playlistHandler?.currentMediaPlayer != null
183
161
  && audioPlayerImpl!!.playlistManager.playlistHandler?.currentMediaPlayer?.isPlaying!!)
@@ -197,8 +175,6 @@ x
197
175
 
198
176
  @PluginMethod
199
177
  fun playTrackByIndex(call: PluginCall) {
200
- call.resolve()
201
- return;
202
178
  val index: Int = call.getInt("index", audioPlayerImpl!!.playlistManager.currentPosition)!!
203
179
  val seekPosition = (call.getInt("position", 0)!! * 1000.0).toLong()
204
180
 
@@ -212,8 +188,6 @@ x
212
188
 
213
189
  @PluginMethod
214
190
  fun playTrackById(call: PluginCall) {
215
- call.resolve()
216
- return;
217
191
  val id: String = call.getString("id")!!
218
192
  if ("" != id) {
219
193
  // alternatively we could search for the item and set the current index to that item.
@@ -230,8 +204,6 @@ x
230
204
 
231
205
  @PluginMethod
232
206
  fun selectTrackByIndex(call: PluginCall) {
233
- call.resolve()
234
- return;
235
207
  val index: Int = call.getInt("index", audioPlayerImpl!!.playlistManager.currentPosition)!!
236
208
 
237
209
  audioPlayerImpl!!.playlistManager.currentPosition = index
@@ -248,8 +220,6 @@ x
248
220
 
249
221
  @PluginMethod
250
222
  fun selectTrackById(call: PluginCall) {
251
- call.resolve()
252
- return;
253
223
  val id: String = call.getString("id")!!
254
224
  if ("" != id) {
255
225
  // alternatively we could search for the item and set the current index to that item.
@@ -267,8 +237,6 @@ x
267
237
 
268
238
  @PluginMethod
269
239
  fun pause(call: PluginCall) {
270
- call.resolve()
271
- return;
272
240
  audioPlayerImpl!!.playlistManager.invokePausePlay()
273
241
 
274
242
  call.resolve()
@@ -278,8 +246,6 @@ x
278
246
 
279
247
  @PluginMethod
280
248
  fun skipForward(call: PluginCall) {
281
- call.resolve()
282
- return;
283
249
  audioPlayerImpl!!.playlistManager.invokeNext()
284
250
 
285
251
  call.resolve()
@@ -289,8 +255,6 @@ x
289
255
 
290
256
  @PluginMethod
291
257
  fun skipBack(call: PluginCall) {
292
- call.resolve()
293
- return;
294
258
  audioPlayerImpl!!.playlistManager.invokePrevious()
295
259
 
296
260
  call.resolve()
@@ -300,8 +264,6 @@ x
300
264
 
301
265
  @PluginMethod
302
266
  fun seekTo(call: PluginCall) {
303
- call.resolve()
304
- return;
305
267
  var position: Long = 0
306
268
  val progress: MediaProgress? = audioPlayerImpl!!.playlistManager.currentProgress
307
269
  if (progress != null) {
@@ -323,8 +285,6 @@ x
323
285
 
324
286
  @PluginMethod
325
287
  fun setPlaybackRate(call: PluginCall) {
326
- call.resolve()
327
- return;
328
288
  val speed = call.getFloat("rate", audioPlayerImpl!!.playlistManager.getPlaybackSpeed())!!
329
289
  audioPlayerImpl!!.playlistManager.setPlaybackSpeed(speed)
330
290
 
@@ -335,8 +295,6 @@ x
335
295
 
336
296
  @PluginMethod
337
297
  fun setVolume(call: PluginCall) {
338
- call.resolve()
339
- return;
340
298
  val volume = call.getFloat("volume", audioPlayerImpl!!.volume)!!
341
299
  audioPlayerImpl!!.volume = volume
342
300
 
@@ -348,12 +306,10 @@ x
348
306
  override fun handleOnDestroy() {
349
307
  Log.d(TAG, "Plugin destroy")
350
308
  super.handleOnDestroy()
351
- return;
352
309
  destroyResources()
353
310
  }
354
311
 
355
312
  override fun onError(errorCode: RmxAudioErrorType?, trackId: String?, message: String?) {
356
- return;
357
313
  if (statusCallback == null) {
358
314
  return
359
315
  }
@@ -362,7 +318,6 @@ x
362
318
  }
363
319
 
364
320
  override fun onStatus(what: RmxAudioStatusMessage, trackId: String?, param: JSONObject?) {
365
- return;
366
321
  if (statusCallback == null) {
367
322
  return
368
323
  }
@@ -370,7 +325,6 @@ x
370
325
  }
371
326
 
372
327
  private fun destroyResources() {
373
- return;
374
328
  statusCallback = null
375
329
  audioPlayerImpl!!.playlistManager.clearItems()
376
330
  }
@@ -397,7 +351,6 @@ x
397
351
  }
398
352
 
399
353
  fun emit(name: String, data: JSObject) {
400
- return;
401
354
  this.notifyListeners(name, data, true)
402
355
  }
403
356
  }
@@ -16,7 +16,6 @@ import org.dwbn.plugins.playlist.service.MediaImageProvider.OnImageUpdatedListen
16
16
  class MediaService : BasePlaylistService<AudioTrack, PlaylistManager>() {
17
17
  override fun onCreate() {
18
18
  super.onCreate()
19
- return;
20
19
  // Adds the audio player implementation, otherwise there's nothing to play media with
21
20
  val newAudio = AudioApi(applicationContext)
22
21
  newAudio.addErrorListener(playlistManager)
@@ -25,7 +24,7 @@ class MediaService : BasePlaylistService<AudioTrack, PlaylistManager>() {
25
24
 
26
25
  override fun onDestroy() {
27
26
  super.onDestroy()
28
- return;
27
+
29
28
  // Releases and clears all the MediaPlayersMediaImageProvider
30
29
  for (player in playlistManager.mediaPlayers) {
31
30
  player.release()
@@ -6,13 +6,13 @@ ext {
6
6
  }
7
7
 
8
8
  buildscript {
9
- ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.8.20'
9
+ ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.10'
10
10
  repositories {
11
11
  google()
12
12
  mavenCentral()
13
13
  }
14
14
  dependencies {
15
- classpath 'com.android.tools.build:gradle:8.0.0'
15
+ classpath 'com.android.tools.build:gradle:8.2.1'
16
16
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
17
17
  }
18
18
  }
@@ -22,10 +22,10 @@ apply plugin: 'kotlin-android'
22
22
 
23
23
  android {
24
24
  namespace "org.dwbn.plugins.playlist"
25
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
25
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
26
26
  defaultConfig {
27
27
  minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
28
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
28
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
29
29
  versionCode 1
30
30
  versionName "1.0"
31
31
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -1,6 +1,7 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
4
4
  networkTimeout=10000
5
+ validateDistributionUrl=true
5
6
  zipStoreBase=GRADLE_USER_HOME
6
7
  zipStorePath=wrapper/dists
package/android/gradlew CHANGED
@@ -85,9 +85,6 @@ done
85
85
  APP_BASE_NAME=${0##*/}
86
86
  APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
87
87
 
88
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89
- DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90
-
91
88
  # Use the maximum available, or set MAX_FD != -1 to use that value.
92
89
  MAX_FD=maximum
93
90
 
@@ -133,10 +130,13 @@ location of your Java installation."
133
130
  fi
134
131
  else
135
132
  JAVACMD=java
136
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
133
+ if ! command -v java >/dev/null 2>&1
134
+ then
135
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137
136
 
138
137
  Please set the JAVA_HOME variable in your environment to match the
139
138
  location of your Java installation."
139
+ fi
140
140
  fi
141
141
 
142
142
  # Increase the maximum file descriptors if we can.
@@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
197
197
  done
198
198
  fi
199
199
 
200
+
201
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
202
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
203
+
200
204
  # Collect all arguments for the java command;
201
205
  # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202
206
  # shell script including quotes and variable substitutions, so put them in
package/dist/docs.json CHANGED
@@ -7,27 +7,27 @@
7
7
  "methods": [
8
8
  {
9
9
  "name": "addListener",
10
- "signature": "(eventName: 'status', listenerFunc: PlaylistStatusChangeCallback) => PluginListenerHandle",
10
+ "signature": "(eventName: 'status', listenerFunc: PlaylistStatusChangeCallback) => Promise<PluginListenerHandle>",
11
11
  "parameters": [
12
12
  {
13
13
  "name": "eventName",
14
14
  "docs": "",
15
- "type": "'status'"
15
+ "type": "\"status\""
16
16
  },
17
17
  {
18
18
  "name": "listenerFunc",
19
19
  "docs": "",
20
- "type": "PlaylistStatusChangeCallback"
20
+ "type": "(data: PlaylistStatusChangeCallbackArg) => void"
21
21
  }
22
22
  ],
23
- "returns": "PluginListenerHandle",
23
+ "returns": "Promise<PluginListenerHandle>",
24
24
  "tags": [],
25
25
  "docs": "Listen for screen reader state change (on/off)",
26
26
  "complexTypes": [
27
27
  "PluginListenerHandle",
28
28
  "PlaylistStatusChangeCallback"
29
29
  ],
30
- "slug": "addlistenerstatus-"
30
+ "slug": "addlistener"
31
31
  },
32
32
  {
33
33
  "name": "setOptions",
@@ -371,282 +371,6 @@
371
371
  }
372
372
  ]
373
373
  },
374
- {
375
- "name": "PlaylistStatusChangeCallbackArg",
376
- "slug": "playliststatuschangecallbackarg",
377
- "docs": "",
378
- "tags": [],
379
- "methods": [],
380
- "properties": [
381
- {
382
- "name": "action",
383
- "tags": [],
384
- "docs": "",
385
- "complexTypes": [],
386
- "type": "string"
387
- },
388
- {
389
- "name": "status",
390
- "tags": [],
391
- "docs": "",
392
- "complexTypes": [
393
- "OnStatusCallbackData"
394
- ],
395
- "type": "OnStatusCallbackData"
396
- }
397
- ]
398
- },
399
- {
400
- "name": "OnStatusCallbackData",
401
- "slug": "onstatuscallbackdata",
402
- "docs": "Encapsulates the data received by an onStatus callback",
403
- "tags": [],
404
- "methods": [],
405
- "properties": [
406
- {
407
- "name": "trackId",
408
- "tags": [],
409
- "docs": "The ID of this track. If the track is null or has completed, this value is \"NONE\"\nIf the playlist is completed, this value is \"INVALID\"",
410
- "complexTypes": [],
411
- "type": "string"
412
- },
413
- {
414
- "name": "msgType",
415
- "tags": [],
416
- "docs": "The type of status update",
417
- "complexTypes": [
418
- "RmxAudioStatusMessage"
419
- ],
420
- "type": "RmxAudioStatusMessage"
421
- },
422
- {
423
- "name": "value",
424
- "tags": [],
425
- "docs": "The status payload. For all updates except ERROR, the data package is described by OnStatusCallbackUpdateData.\nFor Errors, the data is shaped as OnStatusErrorCallbackData",
426
- "complexTypes": [
427
- "OnStatusCallbackUpdateData",
428
- "OnStatusTrackChangedData",
429
- "OnStatusErrorCallbackData"
430
- ],
431
- "type": "OnStatusCallbackUpdateData | OnStatusTrackChangedData | OnStatusErrorCallbackData"
432
- }
433
- ]
434
- },
435
- {
436
- "name": "OnStatusCallbackUpdateData",
437
- "slug": "onstatuscallbackupdatedata",
438
- "docs": "Contains the current track status as of the moment an onStatus update event is emitted.",
439
- "tags": [],
440
- "methods": [],
441
- "properties": [
442
- {
443
- "name": "trackId",
444
- "tags": [],
445
- "docs": "The ID of this track corresponding to this event. If the track is null or has completed, this value is \"NONE\".\nThis will happen when skipping to the beginning or end of the playlist.\nIf the playlist is completed, this value is \"INVALID\"",
446
- "complexTypes": [],
447
- "type": "string"
448
- },
449
- {
450
- "name": "isStream",
451
- "tags": [],
452
- "docs": "Boolean indicating whether this is a streaming track.",
453
- "complexTypes": [],
454
- "type": "boolean"
455
- },
456
- {
457
- "name": "currentIndex",
458
- "tags": [],
459
- "docs": "The current index of the track in the playlist.",
460
- "complexTypes": [],
461
- "type": "number"
462
- },
463
- {
464
- "name": "status",
465
- "tags": [],
466
- "docs": "The current status of the track, as a string. This is used\nto summarize the various event states that a track can be in; e.g. \"playing\" is true for any number\nof track statuses. The Javascript interface takes care of this for you; this field is here only for reference.",
467
- "complexTypes": [],
468
- "type": "'error' | 'unknown' | 'ready' | 'playing' | 'loading' | 'paused'"
469
- },
470
- {
471
- "name": "currentPosition",
472
- "tags": [],
473
- "docs": "Current playback position of the reported track.",
474
- "complexTypes": [],
475
- "type": "number"
476
- },
477
- {
478
- "name": "duration",
479
- "tags": [],
480
- "docs": "The known duration of the reported track. For streams or malformed MP3's, this value will be 0.",
481
- "complexTypes": [],
482
- "type": "number"
483
- },
484
- {
485
- "name": "playbackPercent",
486
- "tags": [],
487
- "docs": "Progress of track playback, as a percent, in the range 0 - 100",
488
- "complexTypes": [],
489
- "type": "number"
490
- },
491
- {
492
- "name": "bufferPercent",
493
- "tags": [],
494
- "docs": "Buffering progress of the track, as a percent, in the range 0 - 100",
495
- "complexTypes": [],
496
- "type": "number"
497
- },
498
- {
499
- "name": "bufferStart",
500
- "tags": [],
501
- "docs": "The starting position of the buffering progress. For now, this is always reported as 0.",
502
- "complexTypes": [],
503
- "type": "number"
504
- },
505
- {
506
- "name": "bufferEnd",
507
- "tags": [],
508
- "docs": "The maximum position, in seconds, of the track buffer. For now, only the buffer with the maximum\nplayback position is reported, even if there are other segments (due to seeking, for example).\nPractically speaking you don't need to worry about that, as in both implementations the\nminor gaps are automatically filled in by the underlying players.",
509
- "complexTypes": [],
510
- "type": "number"
511
- }
512
- ]
513
- },
514
- {
515
- "name": "OnStatusTrackChangedData",
516
- "slug": "onstatustrackchangeddata",
517
- "docs": "Reports information about the playlist state when a track changes.\nIncludes the new track, its index, and the state of the playlist.",
518
- "tags": [],
519
- "methods": [],
520
- "properties": [
521
- {
522
- "name": "currentItem",
523
- "tags": [],
524
- "docs": "The new track that has been selected. May be null if you are at the end of the playlist,\nor the playlist has been emptied.",
525
- "complexTypes": [
526
- "AudioTrack"
527
- ],
528
- "type": "AudioTrack"
529
- },
530
- {
531
- "name": "currentIndex",
532
- "tags": [],
533
- "docs": "The 0-based index of the new track. If the playlist has ended or been cleared, this will be -1.",
534
- "complexTypes": [],
535
- "type": "number"
536
- },
537
- {
538
- "name": "isAtEnd",
539
- "tags": [],
540
- "docs": "Indicates whether the playlist is now currently at the last item in the list.",
541
- "complexTypes": [],
542
- "type": "boolean"
543
- },
544
- {
545
- "name": "isAtBeginning",
546
- "tags": [],
547
- "docs": "Indicates whether the playlist is now at the first item in the list",
548
- "complexTypes": [],
549
- "type": "boolean"
550
- },
551
- {
552
- "name": "hasNext",
553
- "tags": [],
554
- "docs": "Indicates if there are additional playlist items after the current item.",
555
- "complexTypes": [],
556
- "type": "boolean"
557
- },
558
- {
559
- "name": "hasPrevious",
560
- "tags": [],
561
- "docs": "Indicates if there are any items before this one in the playlist.",
562
- "complexTypes": [],
563
- "type": "boolean"
564
- }
565
- ]
566
- },
567
- {
568
- "name": "AudioTrack",
569
- "slug": "audiotrack",
570
- "docs": "An audio track for playback by the playlist.",
571
- "tags": [],
572
- "methods": [],
573
- "properties": [
574
- {
575
- "name": "isStream",
576
- "tags": [],
577
- "docs": "This item is a streaming asset. Make sure this is set to true for stream URLs,\notherwise you will get odd behavior when the asset is paused.",
578
- "complexTypes": [],
579
- "type": "boolean | undefined"
580
- },
581
- {
582
- "name": "trackId",
583
- "tags": [],
584
- "docs": "trackId is optional and if not passed in, an auto-generated UUID will be used.",
585
- "complexTypes": [],
586
- "type": "string | undefined"
587
- },
588
- {
589
- "name": "assetUrl",
590
- "tags": [],
591
- "docs": "URL of the asset; can be local, a URL, or a streaming URL.\nIf the asset is a stream, make sure that isStream is set to true,\notherwise the plugin can't properly handle the item's buffer.",
592
- "complexTypes": [],
593
- "type": "string"
594
- },
595
- {
596
- "name": "albumArt",
597
- "tags": [],
598
- "docs": "The local or remote URL to an image asset to be shown for this track.\nIf this is null, the plugin's default image is used.",
599
- "complexTypes": [],
600
- "type": "string | undefined"
601
- },
602
- {
603
- "name": "artist",
604
- "tags": [],
605
- "docs": "The track's artist",
606
- "complexTypes": [],
607
- "type": "string"
608
- },
609
- {
610
- "name": "album",
611
- "tags": [],
612
- "docs": "Album the track belongs to",
613
- "complexTypes": [],
614
- "type": "string"
615
- },
616
- {
617
- "name": "title",
618
- "tags": [],
619
- "docs": "Title of the track",
620
- "complexTypes": [],
621
- "type": "string"
622
- }
623
- ]
624
- },
625
- {
626
- "name": "OnStatusErrorCallbackData",
627
- "slug": "onstatuserrorcallbackdata",
628
- "docs": "Represents an error reported by the onStatus callback.",
629
- "tags": [],
630
- "methods": [],
631
- "properties": [
632
- {
633
- "name": "code",
634
- "tags": [],
635
- "docs": "Error code",
636
- "complexTypes": [
637
- "RmxAudioErrorType"
638
- ],
639
- "type": "RmxAudioErrorType"
640
- },
641
- {
642
- "name": "message",
643
- "tags": [],
644
- "docs": "The error, as a message",
645
- "complexTypes": [],
646
- "type": "string"
647
- }
648
- ]
649
- },
650
374
  {
651
375
  "name": "AudioPlayerOptions",
652
376
  "slug": "audioplayeroptions",
@@ -675,7 +399,7 @@
675
399
  "complexTypes": [
676
400
  "NotificationOptions"
677
401
  ],
678
- "type": "NotificationOptions"
402
+ "type": "NotificationOptions | undefined"
679
403
  }
680
404
  ]
681
405
  },
@@ -710,7 +434,7 @@
710
434
  "Array",
711
435
  "AudioTrack"
712
436
  ],
713
- "type": "Array<AudioTrack>"
437
+ "type": "AudioTrack[]"
714
438
  },
715
439
  {
716
440
  "name": "options",
@@ -1560,6 +1284,64 @@
1560
1284
  }
1561
1285
  ]
1562
1286
  },
1287
+ {
1288
+ "name": "AudioTrack",
1289
+ "slug": "audiotrack",
1290
+ "docs": "An audio track for playback by the playlist.",
1291
+ "tags": [],
1292
+ "methods": [],
1293
+ "properties": [
1294
+ {
1295
+ "name": "isStream",
1296
+ "tags": [],
1297
+ "docs": "This item is a streaming asset. Make sure this is set to true for stream URLs,\notherwise you will get odd behavior when the asset is paused.",
1298
+ "complexTypes": [],
1299
+ "type": "boolean | undefined"
1300
+ },
1301
+ {
1302
+ "name": "trackId",
1303
+ "tags": [],
1304
+ "docs": "trackId is optional and if not passed in, an auto-generated UUID will be used.",
1305
+ "complexTypes": [],
1306
+ "type": "string | undefined"
1307
+ },
1308
+ {
1309
+ "name": "assetUrl",
1310
+ "tags": [],
1311
+ "docs": "URL of the asset; can be local, a URL, or a streaming URL.\nIf the asset is a stream, make sure that isStream is set to true,\notherwise the plugin can't properly handle the item's buffer.",
1312
+ "complexTypes": [],
1313
+ "type": "string"
1314
+ },
1315
+ {
1316
+ "name": "albumArt",
1317
+ "tags": [],
1318
+ "docs": "The local or remote URL to an image asset to be shown for this track.\nIf this is null, the plugin's default image is used.",
1319
+ "complexTypes": [],
1320
+ "type": "string | undefined"
1321
+ },
1322
+ {
1323
+ "name": "artist",
1324
+ "tags": [],
1325
+ "docs": "The track's artist",
1326
+ "complexTypes": [],
1327
+ "type": "string"
1328
+ },
1329
+ {
1330
+ "name": "album",
1331
+ "tags": [],
1332
+ "docs": "Album the track belongs to",
1333
+ "complexTypes": [],
1334
+ "type": "string"
1335
+ },
1336
+ {
1337
+ "name": "title",
1338
+ "tags": [],
1339
+ "docs": "Title of the track",
1340
+ "complexTypes": [],
1341
+ "type": "string"
1342
+ }
1343
+ ]
1344
+ },
1563
1345
  {
1564
1346
  "name": "PlaylistItemOptions",
1565
1347
  "slug": "playlistitemoptions",
@@ -1630,7 +1412,7 @@
1630
1412
  "Array",
1631
1413
  "AudioTrack"
1632
1414
  ],
1633
- "type": "Array<AudioTrack>"
1415
+ "type": "AudioTrack[]"
1634
1416
  }
1635
1417
  ]
1636
1418
  },
@@ -1672,7 +1454,7 @@
1672
1454
  "Array",
1673
1455
  "RemoveItemOptions"
1674
1456
  ],
1675
- "type": "Array<RemoveItemOptions>"
1457
+ "type": "RemoveItemOptions[]"
1676
1458
  }
1677
1459
  ]
1678
1460
  },
@@ -1833,208 +1615,5 @@
1833
1615
  ]
1834
1616
  }
1835
1617
  ],
1836
- "enums": [
1837
- {
1838
- "name": "RmxAudioStatusMessage",
1839
- "slug": "rmxaudiostatusmessage",
1840
- "members": [
1841
- {
1842
- "name": "RMXSTATUS_NONE",
1843
- "value": "0",
1844
- "tags": [],
1845
- "docs": "The starting state of the plugin. You will never see this value;\nit changes before the callbacks are even registered to report changes to this value."
1846
- },
1847
- {
1848
- "name": "RMXSTATUS_REGISTER",
1849
- "value": "1",
1850
- "tags": [],
1851
- "docs": "Raised when the plugin registers the callback handler for onStatus callbacks.\nYou will probably not be able to see this (nor do you need to)."
1852
- },
1853
- {
1854
- "name": "RMXSTATUS_INIT",
1855
- "value": "2",
1856
- "tags": [],
1857
- "docs": "Reserved for future use"
1858
- },
1859
- {
1860
- "name": "RMXSTATUS_ERROR",
1861
- "value": "5",
1862
- "tags": [],
1863
- "docs": "Indicates an error is reported in the 'value' field."
1864
- },
1865
- {
1866
- "name": "RMXSTATUS_LOADING",
1867
- "value": "10",
1868
- "tags": [],
1869
- "docs": "The reported track is being loaded by the player"
1870
- },
1871
- {
1872
- "name": "RMXSTATUS_CANPLAY",
1873
- "value": "11",
1874
- "tags": [],
1875
- "docs": "The reported track is able to begin playback"
1876
- },
1877
- {
1878
- "name": "RMXSTATUS_LOADED",
1879
- "value": "15",
1880
- "tags": [],
1881
- "docs": "The reported track has loaded 100% of the file (either from disc or network)"
1882
- },
1883
- {
1884
- "name": "RMXSTATUS_STALLED",
1885
- "value": "20",
1886
- "tags": [],
1887
- "docs": "(iOS only): Playback has stalled due to insufficient network"
1888
- },
1889
- {
1890
- "name": "RMXSTATUS_BUFFERING",
1891
- "value": "25",
1892
- "tags": [],
1893
- "docs": "Reports an update in the reported track's buffering status"
1894
- },
1895
- {
1896
- "name": "RMXSTATUS_PLAYING",
1897
- "value": "30",
1898
- "tags": [],
1899
- "docs": "The reported track has started (or resumed) playing"
1900
- },
1901
- {
1902
- "name": "RMXSTATUS_PAUSE",
1903
- "value": "35",
1904
- "tags": [],
1905
- "docs": "The reported track has been paused, either by the user or by the system.\n(iOS only): This value is raised when MP3's are malformed (but still playable).\nThese require the user to explicitly press play again. This can be worked\naround and is on the TODO list."
1906
- },
1907
- {
1908
- "name": "RMXSTATUS_PLAYBACK_POSITION",
1909
- "value": "40",
1910
- "tags": [],
1911
- "docs": "Reports a change in the reported track's playback position."
1912
- },
1913
- {
1914
- "name": "RMXSTATUS_SEEK",
1915
- "value": "45",
1916
- "tags": [],
1917
- "docs": "The reported track has seeked.\nOn Android, only the plugin consumer can generate this (Notification controls on Android do not include a seek bar).\nOn iOS, the Command Center includes a seek bar so this will be reported when the user has seeked via Command Center."
1918
- },
1919
- {
1920
- "name": "RMXSTATUS_COMPLETED",
1921
- "value": "50",
1922
- "tags": [],
1923
- "docs": "The reported track has completed playback."
1924
- },
1925
- {
1926
- "name": "RMXSTATUS_DURATION",
1927
- "value": "55",
1928
- "tags": [],
1929
- "docs": "The reported track's duration has changed. This is raised once, when duration is updated for the first time.\nFor streams, this value is never reported."
1930
- },
1931
- {
1932
- "name": "RMXSTATUS_STOPPED",
1933
- "value": "60",
1934
- "tags": [],
1935
- "docs": "All playback has stopped, probably because the plugin is shutting down."
1936
- },
1937
- {
1938
- "name": "RMX_STATUS_SKIP_FORWARD",
1939
- "value": "90",
1940
- "tags": [],
1941
- "docs": "The playlist has skipped forward to the next track.\nOn both Android and iOS, this will be raised if the notification controls/Command Center were used to skip.\nIt is unlikely you need to consume this event: RMXSTATUS_TRACK_CHANGED is also reported when this occurs,\nso you can generalize your track change handling in one place."
1942
- },
1943
- {
1944
- "name": "RMX_STATUS_SKIP_BACK",
1945
- "value": "95",
1946
- "tags": [],
1947
- "docs": "The playlist has skipped back to the previous track.\nOn both Android and iOS, this will be raised if the notification controls/Command Center were used to skip.\nIt is unlikely you need to consume this event: RMXSTATUS_TRACK_CHANGED is also reported when this occurs,\nso you can generalize your track change handling in one place."
1948
- },
1949
- {
1950
- "name": "RMXSTATUS_TRACK_CHANGED",
1951
- "value": "100",
1952
- "tags": [],
1953
- "docs": "Reported when the current track has changed in the native player. This event contains full data about\nthe new track, including the index and the actual track itself. The type of the 'value' field in this case\nis OnStatusTrackChangedData."
1954
- },
1955
- {
1956
- "name": "RMXSTATUS_PLAYLIST_COMPLETED",
1957
- "value": "105",
1958
- "tags": [],
1959
- "docs": "The entire playlist has completed playback.\nAfter this event has been raised, the current item is set to null and the current index to -1."
1960
- },
1961
- {
1962
- "name": "RMXSTATUS_ITEM_ADDED",
1963
- "value": "110",
1964
- "tags": [],
1965
- "docs": "An item has been added to the playlist. For the setPlaylistItems and addAllItems methods, this status is\nraised once for every track in the collection."
1966
- },
1967
- {
1968
- "name": "RMXSTATUS_ITEM_REMOVED",
1969
- "value": "115",
1970
- "tags": [],
1971
- "docs": "An item has been removed from the playlist. For the removeItems and clearAllItems methods, this status is\nraised once for every track that was removed."
1972
- },
1973
- {
1974
- "name": "RMXSTATUS_PLAYLIST_CLEARED",
1975
- "value": "120",
1976
- "tags": [],
1977
- "docs": "All items have been removed from the playlist"
1978
- },
1979
- {
1980
- "name": "RMXSTATUS_VIEWDISAPPEAR",
1981
- "value": "200",
1982
- "tags": [],
1983
- "docs": "Just for testing.. you don't need this and in fact can never receive it, the plugin is destroyed before it can be raised."
1984
- }
1985
- ]
1986
- },
1987
- {
1988
- "name": "RmxAudioErrorType",
1989
- "slug": "rmxaudioerrortype",
1990
- "members": [
1991
- {
1992
- "name": "RMXERR_NONE_ACTIVE",
1993
- "value": "0",
1994
- "tags": [],
1995
- "docs": ""
1996
- },
1997
- {
1998
- "name": "RMXERR_ABORTED",
1999
- "value": "1",
2000
- "tags": [],
2001
- "docs": ""
2002
- },
2003
- {
2004
- "name": "RMXERR_NETWORK",
2005
- "value": "2",
2006
- "tags": [],
2007
- "docs": ""
2008
- },
2009
- {
2010
- "name": "RMXERR_DECODE",
2011
- "value": "3",
2012
- "tags": [],
2013
- "docs": ""
2014
- },
2015
- {
2016
- "name": "RMXERR_NONE_SUPPORTED",
2017
- "value": "4",
2018
- "tags": [],
2019
- "docs": ""
2020
- }
2021
- ]
2022
- }
2023
- ],
2024
- "typeAliases": [
2025
- {
2026
- "name": "PlaylistStatusChangeCallback",
2027
- "slug": "playliststatuschangecallback",
2028
- "docs": "",
2029
- "types": [
2030
- {
2031
- "text": "(data: PlaylistStatusChangeCallbackArg): void",
2032
- "complexTypes": [
2033
- "PlaylistStatusChangeCallbackArg"
2034
- ]
2035
- }
2036
- ]
2037
- }
2038
- ],
2039
- "pluginConfigs": []
1618
+ "enums": []
2040
1619
  }
@@ -4,7 +4,7 @@ export interface PlaylistPlugin {
4
4
  /**
5
5
  * Listen for screen reader state change (on/off)
6
6
  */
7
- addListener(eventName: 'status', listenerFunc: PlaylistStatusChangeCallback): PluginListenerHandle;
7
+ addListener(eventName: 'status', listenerFunc: PlaylistStatusChangeCallback): Promise<PluginListenerHandle>;
8
8
  setOptions(options: AudioPlayerOptions): Promise<void>;
9
9
  initialize(): Promise<void>;
10
10
  release(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-plugin-playlist",
3
- "version": "0.4.2",
3
+ "version": "0.5.1",
4
4
  "description": "Playlist ",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -32,15 +32,15 @@
32
32
  "author": "phiamo",
33
33
  "license": "MIT",
34
34
  "devDependencies": {
35
- "@capacitor/android": "^5.0.0",
36
- "@capacitor/core": "^5.0.0",
37
- "@capacitor/docgen": "^0.2.2",
38
- "@capacitor/ios": "^5.0.0",
35
+ "@capacitor/android": "^6.0.0",
36
+ "@capacitor/core": "^6.0.0",
37
+ "@capacitor/docgen": "^0.0.10",
38
+ "@capacitor/ios": "^6.0.0",
39
39
  "@ionic/prettier-config": "^1.0.1",
40
40
  "@ionic/swiftlint-config": "^1.1.2",
41
- "@ionic/eslint-config": "^0.3.0",
41
+ "@ionic/eslint-config": "^0.4.0",
42
42
  "@types/hls.js": "^0.13.2",
43
- "eslint": "^7.26.0",
43
+ "eslint": "^8.57.0",
44
44
  "prettier": "~2.2.0",
45
45
  "prettier-plugin-java": "~1.0.0",
46
46
  "rimraf": "^3.0.2",
@@ -49,7 +49,7 @@
49
49
  "typescript": "~5.0.2"
50
50
  },
51
51
  "peerDependencies": {
52
- "@capacitor/core": "^5.0.0"
52
+ "@capacitor/core": "^6.0.0"
53
53
  },
54
54
  "prettier": "@ionic/prettier-config",
55
55
  "swiftlint": "@ionic/swiftlint-config",