capacitor-plugin-playlist 0.7.2 → 0.7.3
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.
|
@@ -149,7 +149,7 @@ class PlaylistManager(application: Application) :
|
|
|
149
149
|
|
|
150
150
|
fun addAllItems(its: List<AudioTrack>?) {
|
|
151
151
|
val currentItem = currentItem // may be null
|
|
152
|
-
audioTracks.addAll(its
|
|
152
|
+
audioTracks.addAll(its.orEmpty())
|
|
153
153
|
items =
|
|
154
154
|
audioTracks // not *strictly* needed since they share the reference, but for good measure..
|
|
155
155
|
currentPosition = audioTracks.indexOf(currentItem)
|
|
@@ -212,9 +212,7 @@ class PlaylistManager(application: Application) :
|
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
fun clearItems() {
|
|
215
|
-
|
|
216
|
-
playlistHandler!!.stop()
|
|
217
|
-
}
|
|
215
|
+
playlistHandler?.stop()
|
|
218
216
|
audioTracks.clear()
|
|
219
217
|
items = audioTracks
|
|
220
218
|
currentPosition = INVALID_POSITION
|
|
@@ -257,11 +255,16 @@ class PlaylistManager(application: Application) :
|
|
|
257
255
|
return playbackSpeed
|
|
258
256
|
}
|
|
259
257
|
|
|
260
|
-
fun setPlaybackSpeed(@FloatRange(from = 0.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
258
|
+
fun setPlaybackSpeed(@FloatRange(from = 0.0625, to = 1.0) speed: Float) {
|
|
259
|
+
val validSpeed = speed.coerceIn(0.0625f, 1.0f)
|
|
260
|
+
playbackSpeed = validSpeed
|
|
261
|
+
playlistHandler?.let { handler ->
|
|
262
|
+
handler.currentMediaPlayer?.let { mediaPlayer ->
|
|
263
|
+
if (mediaPlayer is AudioApi) {
|
|
264
|
+
Log.i(TAG, "setPlaybackSpeed completing with speed = $validSpeed")
|
|
265
|
+
mediaPlayer.setPlaybackSpeed(playbackSpeed)
|
|
266
|
+
}
|
|
267
|
+
}
|
|
265
268
|
}
|
|
266
269
|
}
|
|
267
270
|
|