@dwbn/capacitor-plugin-playlist 0.0.0-stage → 8.4.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.
Files changed (147) hide show
  1. package/DwbnCapacitorPluginPlaylist.podspec +17 -0
  2. package/LICENSE +22 -0
  3. package/Package.swift +34 -0
  4. package/README.md +107 -2
  5. package/android/.project +34 -0
  6. package/android/build.gradle +103 -0
  7. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  8. package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  9. package/android/gradle.properties +22 -0
  10. package/android/gradlew +251 -0
  11. package/android/gradlew.bat +94 -0
  12. package/android/proguard-rules.pro +21 -0
  13. package/android/settings.gradle +2 -0
  14. package/android/src/androidTest/AndroidManifest.xml +9 -0
  15. package/android/src/androidTest/assets/hls/playlist.m3u8 +12 -0
  16. package/android/src/androidTest/assets/hls/seg0.ts +0 -0
  17. package/android/src/androidTest/assets/hls/seg1.ts +0 -0
  18. package/android/src/androidTest/assets/hls/seg2.ts +0 -0
  19. package/android/src/androidTest/assets/tone.mp3 +0 -0
  20. package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +29 -0
  21. package/android/src/androidTest/java/org/dwbn/plugins/playlist/ExtensionlessStreamPlaybackTest.kt +242 -0
  22. package/android/src/main/AndroidManifest.xml +18 -0
  23. package/android/src/main/java/org/dwbn/plugins/playlist/App.kt +6 -0
  24. package/android/src/main/java/org/dwbn/plugins/playlist/AudioDrm.java +105 -0
  25. package/android/src/main/java/org/dwbn/plugins/playlist/AudioDrmProvider.java +19 -0
  26. package/android/src/main/java/org/dwbn/plugins/playlist/AudioDrmSession.java +21 -0
  27. package/android/src/main/java/org/dwbn/plugins/playlist/AudioMediaItemFactory.java +140 -0
  28. package/android/src/main/java/org/dwbn/plugins/playlist/AudioOffline.java +70 -0
  29. package/android/src/main/java/org/dwbn/plugins/playlist/AudioOfflineProvider.java +62 -0
  30. package/android/src/main/java/org/dwbn/plugins/playlist/FakeR.kt +39 -0
  31. package/android/src/main/java/org/dwbn/plugins/playlist/OnStatusCallback.kt +34 -0
  32. package/android/src/main/java/org/dwbn/plugins/playlist/OnStatusReportListener.java +7 -0
  33. package/android/src/main/java/org/dwbn/plugins/playlist/PlaylistItemOptions.java +52 -0
  34. package/android/src/main/java/org/dwbn/plugins/playlist/PlaylistPlugin.kt +734 -0
  35. package/android/src/main/java/org/dwbn/plugins/playlist/PlaylistRuntime.kt +16 -0
  36. package/android/src/main/java/org/dwbn/plugins/playlist/RmxAudioErrorType.java +13 -0
  37. package/android/src/main/java/org/dwbn/plugins/playlist/RmxAudioPlayer.java +572 -0
  38. package/android/src/main/java/org/dwbn/plugins/playlist/RmxAudioStatusMessage.java +37 -0
  39. package/android/src/main/java/org/dwbn/plugins/playlist/RmxConstants.java +42 -0
  40. package/android/src/main/java/org/dwbn/plugins/playlist/RmxPlaybackErrorMapper.kt +46 -0
  41. package/android/src/main/java/org/dwbn/plugins/playlist/TrackRemovalItem.java +12 -0
  42. package/android/src/main/java/org/dwbn/plugins/playlist/data/AudioTrack.kt +131 -0
  43. package/android/src/main/java/org/dwbn/plugins/playlist/handoff/VideoPlayerBridge.kt +102 -0
  44. package/android/src/main/java/org/dwbn/plugins/playlist/manager/DrmTerminalLoadErrorPolicy.kt +23 -0
  45. package/android/src/main/java/org/dwbn/plugins/playlist/manager/MediaControlsListener.kt +13 -0
  46. package/android/src/main/java/org/dwbn/plugins/playlist/manager/Options.kt +77 -0
  47. package/android/src/main/java/org/dwbn/plugins/playlist/manager/PlaybackProgress.kt +8 -0
  48. package/android/src/main/java/org/dwbn/plugins/playlist/manager/PlaylistManager.kt +1033 -0
  49. package/android/src/main/java/org/dwbn/plugins/playlist/manager/PlaylistPlaybackPolicy.kt +178 -0
  50. package/android/src/main/java/org/dwbn/plugins/playlist/manager/RmxPlaybackState.kt +13 -0
  51. package/android/src/main/java/org/dwbn/plugins/playlist/offline/HlsWidevineSessionKey.kt +61 -0
  52. package/android/src/main/java/org/dwbn/plugins/playlist/offline/Media3OfflineEngine.kt +332 -0
  53. package/android/src/main/java/org/dwbn/plugins/playlist/offline/OfflineDownloadService.kt +45 -0
  54. package/android/src/main/java/org/dwbn/plugins/playlist/offline/OfflineDownloads.kt +395 -0
  55. package/android/src/main/java/org/dwbn/plugins/playlist/offline/OfflineEngine.kt +49 -0
  56. package/android/src/main/java/org/dwbn/plugins/playlist/offline/OfflineMetaStore.kt +71 -0
  57. package/android/src/main/java/org/dwbn/plugins/playlist/offline/OfflineStorage.kt +141 -0
  58. package/android/src/main/java/org/dwbn/plugins/playlist/playlist/AudioPlaylistHandler.java +158 -0
  59. package/android/src/main/java/org/dwbn/plugins/playlist/service/GlideBitmapLoader.kt +121 -0
  60. package/android/src/main/java/org/dwbn/plugins/playlist/service/HandoffForwardingPlayer.kt +206 -0
  61. package/android/src/main/java/org/dwbn/plugins/playlist/service/MediaNotificationPolicy.kt +292 -0
  62. package/android/src/main/java/org/dwbn/plugins/playlist/service/MediaService.kt +388 -0
  63. package/android/src/main/java/org/dwbn/plugins/playlist/service/PlaylistMediaSessionCallback.kt +39 -0
  64. package/android/src/main/res/.gitkeep +0 -0
  65. package/android/src/main/res/drawable/ic_closed_caption_white_24dp.xml +9 -0
  66. package/android/src/main/res/drawable/ic_demo_icon_adaptive.xml +15 -0
  67. package/android/src/main/res/drawable/ic_launcher_background.xml +48 -0
  68. package/android/src/main/res/drawable/ic_launcher_foreground.xml +22 -0
  69. package/android/src/main/res/drawable/ic_notification_icon.png +0 -0
  70. package/android/src/main/res/layout/bridge_layout_main.xml +15 -0
  71. package/android/src/main/res/values/colors.xml +3 -0
  72. package/android/src/main/res/values/strings.xml +4 -0
  73. package/android/src/main/res/values/styles.xml +3 -0
  74. package/android/src/test/java/com/getcapacitor/ExampleUnitTest.java +18 -0
  75. package/android/src/test/java/org/dwbn/plugins/playlist/AudioDrmTest.java +137 -0
  76. package/android/src/test/java/org/dwbn/plugins/playlist/AudioMediaItemFactoryMimeTest.kt +144 -0
  77. package/android/src/test/java/org/dwbn/plugins/playlist/AudioMediaItemFactoryTest.java +213 -0
  78. package/android/src/test/java/org/dwbn/plugins/playlist/AudioOfflineTest.java +111 -0
  79. package/android/src/test/java/org/dwbn/plugins/playlist/StatusBridgePolicyTest.kt +56 -0
  80. package/android/src/test/java/org/dwbn/plugins/playlist/data/AudioTrackTest.kt +98 -0
  81. package/android/src/test/java/org/dwbn/plugins/playlist/handoff/VideoPlayerBridgeTest.kt +84 -0
  82. package/android/src/test/java/org/dwbn/plugins/playlist/manager/DrmTerminalLoadErrorPolicyTest.kt +50 -0
  83. package/android/src/test/java/org/dwbn/plugins/playlist/manager/PlaylistManagerAddItemTest.kt +47 -0
  84. package/android/src/test/java/org/dwbn/plugins/playlist/manager/PlaylistManagerAttachDrainTest.kt +71 -0
  85. package/android/src/test/java/org/dwbn/plugins/playlist/manager/PlaylistManagerDrmTest.kt +422 -0
  86. package/android/src/test/java/org/dwbn/plugins/playlist/manager/PlaylistManagerMoveTest.kt +76 -0
  87. package/android/src/test/java/org/dwbn/plugins/playlist/manager/PlaylistManagerOfflineTest.kt +217 -0
  88. package/android/src/test/java/org/dwbn/plugins/playlist/manager/PlaylistManagerReplaceTest.kt +82 -0
  89. package/android/src/test/java/org/dwbn/plugins/playlist/manager/PlaylistPlaybackPolicyTest.kt +190 -0
  90. package/android/src/test/java/org/dwbn/plugins/playlist/offline/HlsWidevineSessionKeyTest.kt +88 -0
  91. package/android/src/test/java/org/dwbn/plugins/playlist/offline/OfflineDownloadsTest.kt +519 -0
  92. package/android/src/test/java/org/dwbn/plugins/playlist/offline/OfflineStorageTest.kt +124 -0
  93. package/android/src/test/java/org/dwbn/plugins/playlist/playlist/AudioPlaylistHandlerTest.kt +145 -0
  94. package/android/src/test/java/org/dwbn/plugins/playlist/service/GlideBitmapLoaderTest.kt +76 -0
  95. package/android/src/test/java/org/dwbn/plugins/playlist/service/HandoffForwardingPlayerTest.kt +333 -0
  96. package/android/src/test/java/org/dwbn/plugins/playlist/service/MediaNotificationPolicyTest.kt +310 -0
  97. package/android/src/test/java/org/dwbn/plugins/playlist/service/VideoHandoffNotificationCommandsTest.kt +54 -0
  98. package/android/src/test/java/org/dwbn/plugins/playlist/service/VideoHandoffNotificationPolicyTest.kt +47 -0
  99. package/dist/docs.json +1943 -0
  100. package/dist/esm/Constants.d.ts +214 -0
  101. package/dist/esm/Constants.js +225 -0
  102. package/dist/esm/Constants.js.map +1 -0
  103. package/dist/esm/RmxAudioPlayer.d.ts +195 -0
  104. package/dist/esm/RmxAudioPlayer.js +369 -0
  105. package/dist/esm/RmxAudioPlayer.js.map +1 -0
  106. package/dist/esm/definitions.d.ts +295 -0
  107. package/dist/esm/definitions.js +2 -0
  108. package/dist/esm/definitions.js.map +1 -0
  109. package/dist/esm/index.d.ts +5 -0
  110. package/dist/esm/index.js +6 -0
  111. package/dist/esm/index.js.map +1 -0
  112. package/dist/esm/interfaces.d.ts +377 -0
  113. package/dist/esm/interfaces.js +2 -0
  114. package/dist/esm/interfaces.js.map +1 -0
  115. package/dist/esm/plugin.d.ts +3 -0
  116. package/dist/esm/plugin.js +13 -0
  117. package/dist/esm/plugin.js.map +1 -0
  118. package/dist/esm/utils.d.ts +15 -0
  119. package/dist/esm/utils.js +48 -0
  120. package/dist/esm/utils.js.map +1 -0
  121. package/dist/esm/web.d.ts +92 -0
  122. package/dist/esm/web.js +639 -0
  123. package/dist/esm/web.js.map +1 -0
  124. package/dist/plugin.cjs.js +1300 -0
  125. package/dist/plugin.cjs.js.map +1 -0
  126. package/dist/plugin.js +1303 -0
  127. package/dist/plugin.js.map +1 -0
  128. package/ios/Sources/PlaylistPlugin/AVBidirectionalQueuePlayer.swift +320 -0
  129. package/ios/Sources/PlaylistPlugin/AudioDrm.swift +122 -0
  130. package/ios/Sources/PlaylistPlugin/AudioOffline.swift +92 -0
  131. package/ios/Sources/PlaylistPlugin/AudioOfflineProvider.swift +59 -0
  132. package/ios/Sources/PlaylistPlugin/AudioTrack.swift +160 -0
  133. package/ios/Sources/PlaylistPlugin/Constants.swift +41 -0
  134. package/ios/Sources/PlaylistPlugin/DispatchQueue.swift +47 -0
  135. package/ios/Sources/PlaylistPlugin/Plugin.swift +477 -0
  136. package/ios/Sources/PlaylistPlugin/RmxAudioPlayer.swift +1684 -0
  137. package/ios/Sources/PlaylistPlugin/offline/AvAssetOfflineEngine.swift +772 -0
  138. package/ios/Sources/PlaylistPlugin/offline/OfflineDownloads.swift +432 -0
  139. package/ios/Sources/PlaylistPlugin/offline/OfflineMetaStore.swift +158 -0
  140. package/ios/Tests/PlaylistPluginTests/AudioDrmTests.swift +331 -0
  141. package/ios/Tests/PlaylistPluginTests/AudioOfflineTests.swift +434 -0
  142. package/ios/Tests/PlaylistPluginTests/OfflineDownloadsTests.swift +458 -0
  143. package/ios/Tests/PlaylistPluginTests/PlaylistMutationTests.swift +206 -0
  144. package/ios/Tests/PlaylistPluginTests/PluginTests.swift +23 -0
  145. package/ios/Tests/PlaylistPluginTests/PositionResumeTests.swift +168 -0
  146. package/ios/Tests/PlaylistPluginTests/StallDetectionTests.swift +110 -0
  147. package/package.json +88 -4
@@ -0,0 +1,17 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'DwbnCapacitorPluginPlaylist'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.license = package['license']
10
+ s.homepage = package['repository']['url']
11
+ s.author = package['author']
12
+ s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
+ s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
+ s.ios.deployment_target = '15.0'
15
+ s.dependency 'Capacitor'
16
+ s.swift_version = '5.3'
17
+ end
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Rolamix
4
+ Copyright (c) 2020-2026 Philipp Mohrenweiser and contributors
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/Package.swift ADDED
@@ -0,0 +1,34 @@
1
+ // swift-tools-version: 6.0
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "DwbnCapacitorPluginPlaylist",
6
+ platforms: [.iOS(.v15)],
7
+ products: [
8
+ .library(
9
+ name: "DwbnCapacitorPluginPlaylist",
10
+ targets: ["PlaylistPlugin"]),
11
+ .library(
12
+ name: "CapacitorPluginPlaylist",
13
+ targets: ["PlaylistPlugin"]),
14
+ ],
15
+ dependencies: [
16
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
17
+ ],
18
+ targets: [
19
+ .target(
20
+ name: "PlaylistPlugin",
21
+ dependencies: [
22
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
23
+ .product(name: "Cordova", package: "capacitor-swift-pm")
24
+ ],
25
+ path: "ios/Sources/PlaylistPlugin",
26
+ swiftSettings: [
27
+ .swiftLanguageMode(.v5),
28
+ ]),
29
+ .testTarget(
30
+ name: "PlaylistPluginTests",
31
+ dependencies: ["PlaylistPlugin"],
32
+ path: "ios/Tests/PlaylistPluginTests")
33
+ ]
34
+ )
package/README.md CHANGED
@@ -1,3 +1,108 @@
1
- # Temporary Holding Version
1
+ # @dwbn/capacitor-plugin-playlist
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Native audio playlists for Capacitor on **Android**, **iOS** and **Web**. Supports background playback, lock-screen and notification controls, a clean handoff to native video, Widevine DRM on Android, FairPlay DRM on iOS, and offline downloads of protected HLS audio on both native platforms.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@dwbn/capacitor-plugin-playlist?style=flat-square)](https://www.npmjs.com/package/@dwbn/capacitor-plugin-playlist)
6
+ [![CI](https://img.shields.io/github/actions/workflow/status/phiamo/capacitor-plugin-playlist/release-package.yml?branch=main&style=flat-square)](https://github.com/phiamo/capacitor-plugin-playlist/actions/workflows/release-package.yml)
7
+ [![license](https://img.shields.io/npm/l/@dwbn/capacitor-plugin-playlist?style=flat-square)](./LICENSE)
8
+ [![Capacitor 8](https://img.shields.io/badge/capacitor-8-119EFF?style=flat-square)](https://capacitorjs.com)
9
+
10
+ [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/W8V527Q5YX)
11
+
12
+ > 📦 **New package name.** This plugin is now published as **`@dwbn/capacitor-plugin-playlist`** in the `@dwbn` npm organization. The unscoped `capacitor-plugin-playlist` is deprecated and receives no further releases. The repository stays here. [How to switch →](./docs/upgrading.md#capacitor-plugin-playlist--dwbncapacitor-plugin-playlist)
13
+
14
+ ## Part of the DWBN media stack
15
+
16
+ | | Project | What it does |
17
+ |---|---|---|
18
+ | 🎵 | **capacitor-plugin-playlist** (this repo) · [`@dwbn/capacitor-plugin-playlist`](https://www.npmjs.com/package/@dwbn/capacitor-plugin-playlist) | Background audio playlists, lock screen, audio↔video handoff |
19
+ | 🎬 | [**capacitor-video-player**](https://github.com/phiamo/capacitor-video-player) · [`@dwbn/capacitor-video-player`](https://www.npmjs.com/package/@dwbn/capacitor-video-player) | Native fullscreen video with Media3 / AVPlayer, PiP, Chromecast and subtitles |
20
+ | 🔐 | [**drm-kit**](https://github.com/phiamo/drm-kit) · Swift Package Manager / JitPack | Widevine session and DRM identifiers that the host app plugs into both plugins |
21
+
22
+ The plugins work on their own. drm-kit is optional and is added by the **app**, never by a plugin. The [audio ↔ video handoff guide](./docs/video-handoff.md) shows all three working together.
23
+
24
+ ## Platform support
25
+
26
+ | | Android | iOS | Web |
27
+ |---|---|---|---|
28
+ | Engine | androidx.media3 1.11.1 (`MediaSessionService`) | `AVBidirectionalQueuePlayer` (AVQueuePlayer) | `HTMLAudioElement` + optional hls.js |
29
+ | Background playback | ✅ foreground media service | ✅ `UIBackgroundModes: audio` | — |
30
+ | Lock screen / notification | ✅ MediaStyle notification | ✅ Now Playing / Control Center | Browser media controls |
31
+ | HLS | ✅ | ✅ | ✅ with hls.js |
32
+ | Video handoff | ✅ (with optional prewarm) | ✅ | stub (pause + position) |
33
+ | DRM | ✅ Widevine via [drm-kit](./docs/drm.md) | ✅ FairPlay via [drm-kit](./docs/drm.md) | — |
34
+ | Offline downloads | ✅ Widevine HLS | ✅ FairPlay HLS | — |
35
+ | Minimum | SDK 24 | iOS 15 | modern browsers |
36
+
37
+ Requires **Capacitor 8** (`@capacitor/core >= 8.0.0`).
38
+
39
+ ## Install
40
+
41
+ ```bash
42
+ npm i @dwbn/capacitor-plugin-playlist
43
+ npx cap sync
44
+ ```
45
+
46
+ On iOS, add `audio` to `UIBackgroundModes`. On Android 13+, request `POST_NOTIFICATIONS`. The [installation guide](./docs/installation.md) has the full platform setup, including the notification icon, Glide and the Media3 version pin.
47
+
48
+ ## Quick start
49
+
50
+ ```typescript
51
+ import { Playlist, RmxAudioStatusMessage, OnStatusCallbackUpdateData } from '@dwbn/capacitor-plugin-playlist';
52
+
53
+ await Playlist.setOptions({ options: { icon: 'ic_notification' } });
54
+ await Playlist.initialize();
55
+
56
+ await Playlist.addListener('status', ({ status }) => {
57
+ if (status.msgType === RmxAudioStatusMessage.RMXSTATUS_PLAYBACK_POSITION) {
58
+ const { currentPosition, duration } = status.value as OnStatusCallbackUpdateData;
59
+ console.log(`${currentPosition} / ${duration}s`);
60
+ }
61
+ });
62
+
63
+ await Playlist.setPlaylistItems({
64
+ items: [{
65
+ trackId: 'track-1',
66
+ assetUrl: 'https://example.com/audio.mp3',
67
+ title: 'Track title',
68
+ artist: 'Artist',
69
+ album: 'Album',
70
+ albumArt: 'https://example.com/cover.jpg',
71
+ }],
72
+ options: {},
73
+ });
74
+ await Playlist.play();
75
+ ```
76
+
77
+ Coming from `cordova-plugin-playlist`? The `RmxAudioPlayer` wrapper is a drop-in replacement ([usage](./docs/usage.md#migrating-from-cordova-plugin-playlist)).
78
+
79
+ ## Documentation
80
+
81
+ | Guide | |
82
+ |---|---|
83
+ | [Installation](./docs/installation.md) | Android manifest, Media3 pin, notification icon, Glide, iOS background mode, web/hls.js |
84
+ | [Usage](./docs/usage.md) | Features, playlist management, `RmxAudioPlayer`, Cordova migration |
85
+ | [Events](./docs/events.md) | The `status` stream: message types, payloads, track states |
86
+ | [Audio ↔ video handoff](./docs/video-handoff.md) | Switch between background audio and native video, with and without DRM |
87
+ | [Protected playback (DRM)](./docs/drm.md) | Widevine on Android with drm-kit, error codes |
88
+ | [API reference](./docs/API.md) | Every method and type (generated) |
89
+ | [Upgrading](./docs/upgrading.md) | Moving to `@dwbn/…`, and from 0.14.x to 8.x |
90
+ | [Legacy versions](./docs/legacy.md) | 0.x version notes and old upgrade paths |
91
+ | [History & credits](./docs/history.md) | From cordova-plugin-playlist to today |
92
+ | [Changelog](./CHANGELOG.md) | Release notes |
93
+
94
+ ## Versioning
95
+
96
+ The major version follows Capacitor's major: **8.x targets Capacitor 8**, the same as [capacitor-video-player](https://github.com/phiamo/capacitor-video-player). Minor and patch versions are this plugin's own. There was never a 1.x–7.x: 8.0.0 came straight after 0.15.0 ([why](./docs/legacy.md)).
97
+
98
+ ## Not supported
99
+
100
+ Shuffle, audio ads / IMA ([#71](https://github.com/phiamo/capacitor-plugin-playlist/issues/71)), and mixing with other audio. Lock-screen controls need exclusive audio focus. For low-latency game sounds, use [cordova-plugin-nativeaudio](https://github.com/floatinghotpot/cordova-plugin-nativeaudio).
101
+
102
+ ## History & credits
103
+
104
+ Started in 2020 as the Capacitor port of [**Rolamix/cordova-plugin-playlist**](https://github.com/Rolamix/cordova-plugin-playlist). It builds on ideas and code from [ExoMedia / PlaylistCore](https://github.com/brianwernick/ExoMedia) (Brian Wernick), the [Bi-Directional AVQueuePlayer](https://github.com/jrtaal/AVBidirectionalQueuePlayer), [cordova-plugin-media](https://github.com/apache/cordova-plugin-media) and [cordova-music-controls-plugin](https://github.com/homerours/cordova-music-controls-plugin). It is maintained by [@phiamo](https://github.com/phiamo) for the DWBN apps, with help from [many contributors](./docs/history.md#contributors). Thank you all 🙏
105
+
106
+ ## License
107
+
108
+ [MIT](./LICENSE)
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>capacitor-plugin-playlist</name>
4
+ <comment>Project capacitor-plugin-playlist created by Buildship.</comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>org.eclipse.jdt.core.javabuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ <buildCommand>
14
+ <name>org.eclipse.buildship.core.gradleprojectbuilder</name>
15
+ <arguments>
16
+ </arguments>
17
+ </buildCommand>
18
+ </buildSpec>
19
+ <natures>
20
+ <nature>org.eclipse.jdt.core.javanature</nature>
21
+ <nature>org.eclipse.buildship.core.gradleprojectnature</nature>
22
+ </natures>
23
+ <filteredResources>
24
+ <filter>
25
+ <id>1717354886357</id>
26
+ <name></name>
27
+ <type>30</type>
28
+ <matcher>
29
+ <id>org.eclipse.core.resources.regexFilterMatcher</id>
30
+ <arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
31
+ </matcher>
32
+ </filter>
33
+ </filteredResources>
34
+ </projectDescription>
@@ -0,0 +1,103 @@
1
+ // Consuming Capacitor apps normally supply the Android/Kotlin Gradle plugin classpath from
2
+ // their own root build.gradle. This buildscript block is only needed to run `./gradlew test`
3
+ // standalone from this module (e.g. `npm run verify:android`); it is additive to this
4
+ // subproject's own build-script classpath and does not affect a parent app's configuration.
5
+ buildscript {
6
+ repositories {
7
+ google()
8
+ mavenCentral()
9
+ }
10
+ dependencies {
11
+ classpath 'com.android.tools.build:gradle:9.4.1'
12
+ classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:2.4.20'
13
+ }
14
+ }
15
+
16
+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
17
+
18
+ ext {
19
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
20
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
21
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
22
+ // Only used when this module is built standalone (e.g. `npm run verify:android`); when
23
+ // embedded, the consuming app's root build.gradle already sets rootProject.ext.kotlin_version.
24
+ kotlin_version = project.hasProperty('kotlinVersion') ? rootProject.ext.kotlinVersion : '2.4.20'
25
+ }
26
+
27
+ apply plugin: 'com.android.library'
28
+
29
+ // AGP 9+ provides built-in Kotlin; applying kotlin-android there fails. Hosts still on AGP 8
30
+ // get the Kotlin plugin applied here.
31
+ def agpMajorVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
32
+ if (agpMajorVersion < 9) {
33
+ apply plugin: 'kotlin-android'
34
+ }
35
+
36
+ android {
37
+ namespace = "org.dwbn.plugins.playlist"
38
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
39
+ defaultConfig {
40
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
41
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
42
+ versionCode 1
43
+ versionName "1.0"
44
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
45
+ }
46
+ buildTypes {
47
+ release {
48
+ minifyEnabled false
49
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
50
+ }
51
+ }
52
+ lint {
53
+ abortOnError = false
54
+ }
55
+ compileOptions {
56
+ sourceCompatibility JavaVersion.VERSION_21
57
+ targetCompatibility JavaVersion.VERSION_21
58
+ }
59
+ }
60
+
61
+ tasks.withType(JavaCompile).configureEach {
62
+ options.compilerArgs << '-Xlint:deprecation'
63
+ }
64
+
65
+ if (agpMajorVersion < 9) {
66
+ kotlin {
67
+ compilerOptions {
68
+ jvmTarget = JvmTarget.JVM_21
69
+ }
70
+ }
71
+ }
72
+
73
+ repositories {
74
+ google()
75
+ mavenCentral()
76
+ }
77
+
78
+
79
+ dependencies {
80
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
81
+ implementation project(':capacitor-android')
82
+ testImplementation "junit:junit:$junitVersion"
83
+ testImplementation "org.robolectric:robolectric:4.17"
84
+ // Real org.json implementation for plain JVM unit tests: the android.jar stub used for
85
+ // compilation throws "Stub!" for org.json.* at runtime outside instrumented/Robolectric tests.
86
+ testImplementation "org.json:json:20260814"
87
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
88
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
89
+ implementation "androidx.core:core-ktx:1.17.0"
90
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlin_version}"
91
+
92
+ def media3Version = '1.11.1'
93
+ implementation "androidx.media3:media3-exoplayer:$media3Version"
94
+ implementation "androidx.media3:media3-exoplayer-hls:$media3Version"
95
+ implementation "androidx.media3:media3-session:$media3Version"
96
+
97
+ // Image Loading (artwork — Story 55.5 wires Glide into Media3 notification)
98
+ implementation 'com.github.bumptech.glide:glide:5.0.7'
99
+ annotationProcessor 'com.github.bumptech.glide:compiler:5.0.7'
100
+
101
+ implementation 'androidx.work:work-runtime-ktx:2.11.2'
102
+
103
+ }
@@ -0,0 +1,7 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-all.zip
4
+ networkTimeout=10000
5
+ validateDistributionUrl=true
6
+ zipStoreBase=GRADLE_USER_HOME
7
+ zipStorePath=wrapper/dists
@@ -0,0 +1,22 @@
1
+ # Project-wide Gradle settings.
2
+
3
+ # IDE (e.g. Android Studio) users:
4
+ # Gradle settings configured through the IDE *will override*
5
+ # any settings specified in this file.
6
+
7
+ # For more details on how to configure your build environment visit
8
+ # http://www.gradle.org/docs/current/userguide/build_environment.html
9
+
10
+ # Specifies the JVM arguments used for the daemon process.
11
+ # The setting is particularly useful for tweaking memory settings.
12
+ org.gradle.jvmargs=-Xmx1536m
13
+
14
+ # When configured, Gradle will run in incubating parallel mode.
15
+ # This option should only be used with decoupled projects. More details, visit
16
+ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17
+ # org.gradle.parallel=true
18
+
19
+ # AndroidX package structure to make it clearer which packages are bundled with the
20
+ # Android operating system, and which are packaged with your app's APK
21
+ # https://developer.android.com/topic/libraries/support-library/androidx-rn
22
+ android.useAndroidX=true
@@ -0,0 +1,251 @@
1
+ #!/bin/sh
2
+
3
+ #
4
+ # Copyright © 2015-2021 the original authors.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # https://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # SPDX-License-Identifier: Apache-2.0
19
+ #
20
+
21
+ ##############################################################################
22
+ #
23
+ # Gradle start up script for POSIX generated by Gradle.
24
+ #
25
+ # Important for running:
26
+ #
27
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28
+ # noncompliant, but you have some other compliant shell such as ksh or
29
+ # bash, then to run this script, type that shell name before the whole
30
+ # command line, like:
31
+ #
32
+ # ksh Gradle
33
+ #
34
+ # Busybox and similar reduced shells will NOT work, because this script
35
+ # requires all of these POSIX shell features:
36
+ # * functions;
37
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39
+ # * compound commands having a testable exit status, especially «case»;
40
+ # * various built-in commands including «command», «set», and «ulimit».
41
+ #
42
+ # Important for patching:
43
+ #
44
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
45
+ # by Bash, Ksh, etc; in particular arrays are avoided.
46
+ #
47
+ # The "traditional" practice of packing multiple parameters into a
48
+ # space-separated string is a well documented source of bugs and security
49
+ # problems, so this is (mostly) avoided, by progressively accumulating
50
+ # options in "$@", and eventually passing that to Java.
51
+ #
52
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53
+ # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54
+ # see the in-line comments for details.
55
+ #
56
+ # There are tweaks for specific operating systems such as AIX, CygWin,
57
+ # Darwin, MinGW, and NonStop.
58
+ #
59
+ # (3) This script is generated from the Groovy template
60
+ # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61
+ # within the Gradle project.
62
+ #
63
+ # You can find Gradle at https://github.com/gradle/gradle/.
64
+ #
65
+ ##############################################################################
66
+
67
+ # Attempt to set APP_HOME
68
+
69
+ # Resolve links: $0 may be a link
70
+ app_path=$0
71
+
72
+ # Need this for daisy-chained symlinks.
73
+ while
74
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75
+ [ -h "$app_path" ]
76
+ do
77
+ ls=$( ls -ld "$app_path" )
78
+ link=${ls#*' -> '}
79
+ case $link in #(
80
+ /*) app_path=$link ;; #(
81
+ *) app_path=$APP_HOME$link ;;
82
+ esac
83
+ done
84
+
85
+ # This is normally unused
86
+ # shellcheck disable=SC2034
87
+ APP_BASE_NAME=${0##*/}
88
+ # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89
+ APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
90
+
91
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
92
+ MAX_FD=maximum
93
+
94
+ warn () {
95
+ echo "$*"
96
+ } >&2
97
+
98
+ die () {
99
+ echo
100
+ echo "$*"
101
+ echo
102
+ exit 1
103
+ } >&2
104
+
105
+ # OS specific support (must be 'true' or 'false').
106
+ cygwin=false
107
+ msys=false
108
+ darwin=false
109
+ nonstop=false
110
+ case "$( uname )" in #(
111
+ CYGWIN* ) cygwin=true ;; #(
112
+ Darwin* ) darwin=true ;; #(
113
+ MSYS* | MINGW* ) msys=true ;; #(
114
+ NONSTOP* ) nonstop=true ;;
115
+ esac
116
+
117
+ CLASSPATH="\\\"\\\""
118
+
119
+
120
+ # Determine the Java command to use to start the JVM.
121
+ if [ -n "$JAVA_HOME" ] ; then
122
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123
+ # IBM's JDK on AIX uses strange locations for the executables
124
+ JAVACMD=$JAVA_HOME/jre/sh/java
125
+ else
126
+ JAVACMD=$JAVA_HOME/bin/java
127
+ fi
128
+ if [ ! -x "$JAVACMD" ] ; then
129
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130
+
131
+ Please set the JAVA_HOME variable in your environment to match the
132
+ location of your Java installation."
133
+ fi
134
+ else
135
+ JAVACMD=java
136
+ if ! command -v java >/dev/null 2>&1
137
+ then
138
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
139
+
140
+ Please set the JAVA_HOME variable in your environment to match the
141
+ location of your Java installation."
142
+ fi
143
+ fi
144
+
145
+ # Increase the maximum file descriptors if we can.
146
+ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
147
+ case $MAX_FD in #(
148
+ max*)
149
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
150
+ # shellcheck disable=SC2039,SC3045
151
+ MAX_FD=$( ulimit -H -n ) ||
152
+ warn "Could not query maximum file descriptor limit"
153
+ esac
154
+ case $MAX_FD in #(
155
+ '' | soft) :;; #(
156
+ *)
157
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
158
+ # shellcheck disable=SC2039,SC3045
159
+ ulimit -n "$MAX_FD" ||
160
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
161
+ esac
162
+ fi
163
+
164
+ # Collect all arguments for the java command, stacking in reverse order:
165
+ # * args from the command line
166
+ # * the main class name
167
+ # * -classpath
168
+ # * -D...appname settings
169
+ # * --module-path (only if needed)
170
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
171
+
172
+ # For Cygwin or MSYS, switch paths to Windows format before running java
173
+ if "$cygwin" || "$msys" ; then
174
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
175
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
176
+
177
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
178
+
179
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
180
+ for arg do
181
+ if
182
+ case $arg in #(
183
+ -*) false ;; # don't mess with options #(
184
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
185
+ [ -e "$t" ] ;; #(
186
+ *) false ;;
187
+ esac
188
+ then
189
+ arg=$( cygpath --path --ignore --mixed "$arg" )
190
+ fi
191
+ # Roll the args list around exactly as many times as the number of
192
+ # args, so each arg winds up back in the position where it started, but
193
+ # possibly modified.
194
+ #
195
+ # NB: a `for` loop captures its iteration list before it begins, so
196
+ # changing the positional parameters here affects neither the number of
197
+ # iterations, nor the values presented in `arg`.
198
+ shift # remove old arg
199
+ set -- "$@" "$arg" # push replacement arg
200
+ done
201
+ fi
202
+
203
+
204
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
205
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
206
+
207
+ # Collect all arguments for the java command:
208
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209
+ # and any embedded shellness will be escaped.
210
+ # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
211
+ # treated as '${Hostname}' itself on the command line.
212
+
213
+ set -- \
214
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
215
+ -classpath "$CLASSPATH" \
216
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217
+ "$@"
218
+
219
+ # Stop when "xargs" is not available.
220
+ if ! command -v xargs >/dev/null 2>&1
221
+ then
222
+ die "xargs is not available"
223
+ fi
224
+
225
+ # Use "xargs" to parse quoted args.
226
+ #
227
+ # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
228
+ #
229
+ # In Bash we could simply go:
230
+ #
231
+ # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
232
+ # set -- "${ARGS[@]}" "$@"
233
+ #
234
+ # but POSIX shell has neither arrays nor command substitution, so instead we
235
+ # post-process each arg (as a line of input to sed) to backslash-escape any
236
+ # character that might be a shell metacharacter, then use eval to reverse
237
+ # that process (while maintaining the separation between arguments), and wrap
238
+ # the whole thing up as a single "set" statement.
239
+ #
240
+ # This will of course break if any of these variables contains a newline or
241
+ # an unmatched quote.
242
+ #
243
+
244
+ eval "set -- $(
245
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
246
+ xargs -n1 |
247
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
248
+ tr '\n' ' '
249
+ )" '"$@"'
250
+
251
+ exec "$JAVACMD" "$@"