capacitor-plugin-playlist 0.8.2 → 0.8.4

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.
Binary file
@@ -195,13 +195,13 @@ public class PlaylistPlugin : Plugin(), OnStatusReportListener {
195
195
  fun getPlaylist(call: PluginCall) {
196
196
  Handler(Looper.getMainLooper()).post {
197
197
  val playlistManager = audioPlayerImpl!!.playlistManager
198
- val audioTracks = playlistManager.items
198
+ val audioTracks = playlistManager.getAllItems()
199
199
  val itemsArray = JSONArray()
200
-
200
+
201
201
  for (track in audioTracks) {
202
202
  itemsArray.put(track.toDict())
203
203
  }
204
-
204
+
205
205
  val result = JSObject()
206
206
  result.put("items", itemsArray)
207
207
  call.resolve(result)
@@ -231,6 +231,10 @@ class PlaylistManager(application: Application) :
231
231
  currentPosition = INVALID_POSITION
232
232
  }
233
233
 
234
+ fun getAllItems(): List<AudioTrack> {
235
+ return audioTracks.toList()
236
+ }
237
+
234
238
  private fun resolveItemPosition(trackIndex: Int, trackId: String): Int {
235
239
  var resolvedPosition = -1
236
240
  if (trackIndex >= 0 && trackIndex < audioTracks.size) {
@@ -50,7 +50,7 @@ class AudioApi(context: Context) : BaseMediaApi() {
50
50
 
51
51
  audioPlayer.setWakeLevel(PowerManager.PARTIAL_WAKE_LOCK)
52
52
  audioPlayer.setAudioAttributes(getAudioAttributes(C.USAGE_MEDIA, C.AUDIO_CONTENT_TYPE_MUSIC))
53
- audioPlayer.setAnalyticsListener(EventLogger(null))
53
+ audioPlayer.setAnalyticsListener(EventLogger())
54
54
  }
55
55
 
56
56
  override fun play() {
@@ -5,7 +5,7 @@ import android.graphics.Bitmap
5
5
  import android.graphics.BitmapFactory
6
6
  import com.bumptech.glide.Glide
7
7
  import com.bumptech.glide.RequestManager
8
- import com.bumptech.glide.request.target.SimpleTarget
8
+ import com.bumptech.glide.request.target.CustomTarget
9
9
  import com.bumptech.glide.request.transition.Transition
10
10
  import com.devbrackets.android.playlistcore.components.image.ImageProvider
11
11
  import org.dwbn.plugins.playlist.FakeR
@@ -63,10 +63,14 @@ class MediaImageProvider(
63
63
  *
64
64
  * **NOTE:** This is a Glide Image loader class
65
65
  */
66
- private inner class RemoteViewImageTarget : SimpleTarget<Bitmap>() {
66
+ private inner class RemoteViewImageTarget : CustomTarget<Bitmap>() {
67
67
  override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
68
68
  artworkImage = resource
69
69
  }
70
+
71
+ override fun onLoadCleared(placeholder: android.graphics.drawable.Drawable?) {
72
+ // No cleanup needed
73
+ }
70
74
  }
71
75
 
72
76
  init {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-plugin-playlist",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Playlist ",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",