@mustafaj/capacitor-plugin-playlist 0.9.0
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.
- package/CapacitorPluginPlaylist.podspec +17 -0
- package/README.md +248 -0
- package/android/.project +34 -0
- package/android/build.gradle +69 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/gradle.properties +22 -0
- package/android/gradlew +251 -0
- package/android/gradlew.bat +94 -0
- package/android/proguard-rules.pro +21 -0
- package/android/settings.gradle +2 -0
- package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +26 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/App.kt +19 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/FakeR.kt +39 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/OnStatusCallback.kt +34 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/OnStatusReportListener.java +7 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/PlaylistItemOptions.java +52 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/PlaylistPlugin.kt +447 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/RmxAudioErrorType.java +13 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/RmxAudioPlayer.java +487 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/RmxAudioStatusMessage.java +35 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/RmxConstants.java +42 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/TrackRemovalItem.java +12 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/data/AudioTrack.kt +94 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/manager/MediaControlsListener.kt +13 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/manager/Options.kt +77 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/manager/PlaylistManager.kt +308 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/notification/PlaylistNotificationProvider.kt +26 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/playlist/AudioApi.kt +114 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/playlist/AudioPlaylistHandler.java +146 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/playlist/BaseMediaApi.kt +36 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/service/MediaImageProvider.kt +83 -0
- package/android/src/main/java/org/dwbn/plugins/playlist/service/MediaService.kt +98 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/android/src/main/res/drawable/ic_closed_caption_white_24dp.xml +9 -0
- package/android/src/main/res/drawable/ic_demo_icon_adaptive.xml +15 -0
- package/android/src/main/res/drawable/ic_launcher_background.xml +48 -0
- package/android/src/main/res/drawable/ic_launcher_foreground.xml +22 -0
- package/android/src/main/res/drawable/ic_notification_icon.png +0 -0
- package/android/src/main/res/layout/bridge_layout_main.xml +15 -0
- package/android/src/main/res/values/colors.xml +3 -0
- package/android/src/main/res/values/strings.xml +3 -0
- package/android/src/main/res/values/styles.xml +3 -0
- package/android/src/test/java/com/getcapacitor/ExampleUnitTest.java +18 -0
- package/dist/docs.json +2071 -0
- package/dist/esm/Constants.d.ts +164 -0
- package/dist/esm/Constants.js +175 -0
- package/dist/esm/Constants.js.map +1 -0
- package/dist/esm/RmxAudioPlayer.d.ts +181 -0
- package/dist/esm/RmxAudioPlayer.js +344 -0
- package/dist/esm/RmxAudioPlayer.js.map +1 -0
- package/dist/esm/definitions.d.ts +78 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/interfaces.d.ts +246 -0
- package/dist/esm/interfaces.js +2 -0
- package/dist/esm/interfaces.js.map +1 -0
- package/dist/esm/plugin.d.ts +3 -0
- package/dist/esm/plugin.js +13 -0
- package/dist/esm/plugin.js.map +1 -0
- package/dist/esm/utils.d.ts +15 -0
- package/dist/esm/utils.js +48 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/esm/web.d.ts +54 -0
- package/dist/esm/web.js +409 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +993 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +996 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/AVBidirectionalQueuePlayer.swift +269 -0
- package/ios/Plugin/AudioTrack.swift +63 -0
- package/ios/Plugin/Constants.swift +39 -0
- package/ios/Plugin/DispatchQueue.swift +47 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/Plugin.h +10 -0
- package/ios/Plugin/Plugin.m +30 -0
- package/ios/Plugin/Plugin.swift +208 -0
- package/ios/Plugin/RmxAudioPlayer.swift +1150 -0
- package/ios/Plugin.xcodeproj/project.pbxproj +574 -0
- package/ios/Plugin.xcworkspace/contents.xcworkspacedata +10 -0
- package/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/PluginTests/Info.plist +22 -0
- package/ios/PluginTests/PluginTests.swift +35 -0
- package/ios/Podfile +16 -0
- package/package.json +89 -0
|
@@ -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 = 'CapacitorPluginPlaylist'
|
|
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/Plugin/**/*.{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/README.md
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# capacitor-plugin-playlist
|
|
2
|
+
|
|
3
|
+
Published fork: `@mustafaj/capacitor-plugin-playlist`
|
|
4
|
+
|
|
5
|
+
A capacitor plugin for Android, iOS and Web with native support for audio playlists, background support, and lock screen controls
|
|
6
|
+
|
|
7
|
+
## 0. Index
|
|
8
|
+
|
|
9
|
+
1. [Background](#1-background)
|
|
10
|
+
2. [Notes](#2-notes)
|
|
11
|
+
3. [Installation](#3-installation)
|
|
12
|
+
4. [Usage](#4-usage)
|
|
13
|
+
5. [Todo](#5-todo)
|
|
14
|
+
6. [Credits](#6-credits)
|
|
15
|
+
7. [License](#7-license)
|
|
16
|
+
|
|
17
|
+
## 1. Background
|
|
18
|
+
|
|
19
|
+
I was using very successfuly cordova-plugin-playlist, many thanks to codinronan an all the contributors!!
|
|
20
|
+
Due to upgrades and further development of the app, which used the plugin we decided to go for capacitor instead of
|
|
21
|
+
cordova, and here we wanna give back to the community our outcome, any help is appreciated!
|
|
22
|
+
|
|
23
|
+
## 2. Notes
|
|
24
|
+
|
|
25
|
+
### On _Android_, utilizes a wrapper over ExoPlayer called [ExoMedia](https://github.com/brianwernick/ExoMedia). ExoPlayer is a powerful, high-quality player for Android provided by Google
|
|
26
|
+
|
|
27
|
+
### On iOS, utilizes a customized AVQueuePlayer in order to provide feedback about track changes, buffering, etc.; given that AVQueuePlayer can keep the audio session running between songs.
|
|
28
|
+
|
|
29
|
+
- This plugin is not designed to play mixable, rapid-fire, low-latency audio, as you would use in a game. A more appropriate cordova plugin for that use case is [cordova-plugin-nativeaudio](https://github.com/floatinghotpot/cordova-plugin-nativeaudio)
|
|
30
|
+
|
|
31
|
+
- Cannot mix audio; again the NativeAudio plugin is probably more appropriate. This is due to supporting the lock screen and command center controls: only an app in command of audio can do this, otherwise the controls have no meaning. I would like to add an option to do this, it should be fairly straightforward; at the cost of not supporting the OS-level controls for that invokation.
|
|
32
|
+
|
|
33
|
+
## 3. Installation
|
|
34
|
+
|
|
35
|
+
As with most capacitor plugins...
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
npm i @mustafaj/capacitor-plugin-playlist
|
|
39
|
+
npx cap sync
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### For web
|
|
43
|
+
|
|
44
|
+
include hlsjs in your build
|
|
45
|
+
|
|
46
|
+
#### E.G. for Angular 2+:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
npm i hls.js
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
then add to angular.json:
|
|
53
|
+
architect => build => options:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
"scripts": [
|
|
57
|
+
{
|
|
58
|
+
"input": "node_modules/hls.js/dist/hls.min.js"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
##### AndroidManifest.xml:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
67
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
68
|
+
<application
|
|
69
|
+
android:name="org.dwbn.plugins.playlist.App"
|
|
70
|
+
>
|
|
71
|
+
<service android:enabled="true" android:exported="false"
|
|
72
|
+
android:name="org.dwbn.plugins.playlist.service.MediaService">
|
|
73
|
+
</service>
|
|
74
|
+
</application>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Note**: Starting with Android 14, you now need to specify the `foregroundServiceType` and request the appropriate permission:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
81
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
|
|
82
|
+
<application
|
|
83
|
+
android:name="org.dwbn.plugins.playlist.App"
|
|
84
|
+
>
|
|
85
|
+
<service android:enabled="true" android:exported="false"
|
|
86
|
+
android:foregroundServiceType="mediaPlayback"
|
|
87
|
+
android:name="org.dwbn.plugins.playlist.service.MediaService">
|
|
88
|
+
</service>
|
|
89
|
+
</application>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
##### Gradle Configuration (Gradle 9+)
|
|
93
|
+
|
|
94
|
+
**Important**: If you're using Gradle 9 or later, you need to ensure the Kotlin plugin is declared in your root `android/build.gradle` file. This plugin no longer includes its own `buildscript` block to avoid conflicts with Gradle 9's plugin loading requirements.
|
|
95
|
+
|
|
96
|
+
Add the Kotlin plugin to your root `android/build.gradle`:
|
|
97
|
+
|
|
98
|
+
```gradle
|
|
99
|
+
buildscript {
|
|
100
|
+
ext.kotlin_version = '2.3.0' // Or your preferred Kotlin version
|
|
101
|
+
|
|
102
|
+
repositories {
|
|
103
|
+
google()
|
|
104
|
+
mavenCentral()
|
|
105
|
+
}
|
|
106
|
+
dependencies {
|
|
107
|
+
classpath 'com.android.tools.build:gradle:8.13.2'
|
|
108
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
109
|
+
// ... other dependencies
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
ext {
|
|
114
|
+
kotlin_version = '2.3.0' // Make it available to subprojects
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The plugin's `build.gradle` will automatically use the Kotlin plugin from the root project. If you see a warning about the Kotlin plugin being loaded multiple times, ensure you've removed any `buildscript` blocks that declare the Kotlin plugin from other subprojects (except the root project).
|
|
119
|
+
|
|
120
|
+
##### Glide image loading for notifiction center
|
|
121
|
+
|
|
122
|
+
To be able to use glide you need to create a file MyAppGlideModule.java:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
package org.your.package.namespace;
|
|
126
|
+
|
|
127
|
+
import com.bumptech.glide.annotation.GlideModule;
|
|
128
|
+
import com.bumptech.glide.module.AppGlideModule;
|
|
129
|
+
|
|
130
|
+
@GlideModule
|
|
131
|
+
public final class MyAppGlideModule extends AppGlideModule {}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
also see https://guides.codepath.com/android/Displaying-Images-with-the-Glide-Library
|
|
135
|
+
|
|
136
|
+
### iOS
|
|
137
|
+
|
|
138
|
+
##### inside Info.plist:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
<key>UIBackgroundModes</key>
|
|
142
|
+
<array>
|
|
143
|
+
<string>audio</string>
|
|
144
|
+
<string>fetch</string>
|
|
145
|
+
</array>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Android normally will give you ~2-3 minutes of background playback before killing your audio. Adding the WAKE_LOCK permission allows the plugin to utilize additional permissions to continue playing.
|
|
149
|
+
|
|
150
|
+
iOS will immediately stop playback when the app goes into the background if you do not include the `audio` `UIBackgroundMode`. iOS has an additional requirement that audio playback must never stop; when it does, the audio session will be terminated and playback cannot continue without user interaction.
|
|
151
|
+
|
|
152
|
+
### Android notification icon
|
|
153
|
+
|
|
154
|
+
To show a better notification icon in Android Lollipop (API 21) and above, create a transparent (silhouette) icon and name the file e.g. as "ic_notification.png".
|
|
155
|
+
Then you can use the options like:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
await Playlist.setOptions({
|
|
159
|
+
verbose: !environment.production,
|
|
160
|
+
options: {
|
|
161
|
+
icon: 'ic_notification'
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
In Android Studio, you can right-click on `res` folder and choose `New > Image Asset`:
|
|
167
|
+
|
|
168
|
+

|
|
169
|
+
|
|
170
|
+
Select type: `Notification Icons` and choose your icon, click `Next` to save it.
|
|
171
|
+
|
|
172
|
+

|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
## 4. Usage
|
|
176
|
+
|
|
177
|
+
Be sure to check out the examples folder, where you can find an Angular10/Ionic5 implementation of the Capacitor plugin.
|
|
178
|
+
Just drop into your project and go.
|
|
179
|
+
Should be quite obvious howto adapt this for other frameworks, or just vanillaJS
|
|
180
|
+
|
|
181
|
+
### API
|
|
182
|
+
|
|
183
|
+
Example:
|
|
184
|
+
@see definition.ts
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
import {Playlist, AudioTrack} from '@mustafaj/capacitor-plugin-playlist'
|
|
188
|
+
|
|
189
|
+
const item: AudioTrack = {
|
|
190
|
+
trackId: 1,
|
|
191
|
+
assetUrl: 'http://your_audio',
|
|
192
|
+
albumArt: 'http://some_image'
|
|
193
|
+
}
|
|
194
|
+
await Playlist.addItem({item})
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
- TODO!
|
|
198
|
+
|
|
199
|
+
### Migrating from cordova-plugin-playlist
|
|
200
|
+
|
|
201
|
+
See the use the shipped RmxAudioPlayer.ts
|
|
202
|
+
|
|
203
|
+
Its a meant as a drop in replacement
|
|
204
|
+
|
|
205
|
+
in the best case you only change your import. :D
|
|
206
|
+
|
|
207
|
+
### Breaking changes
|
|
208
|
+
|
|
209
|
+
- Low-level `Playlist.removeItem()` and `Playlist.removeItems()` calls now accept only `id` / `index`.
|
|
210
|
+
- `trackId` / `trackIndex` remain supported on the higher-level `RmxAudioPlayer` wrapper, which maps them to the canonical plugin contract.
|
|
211
|
+
|
|
212
|
+
## 5. Todo
|
|
213
|
+
|
|
214
|
+
- [iOS] Utilize [AudioPlayer](https://github.com/delannoyk/AudioPlayer) instead of directly implementing AVQueuePlayer. `AudioPlayer` includes some smart network recovery features
|
|
215
|
+
- [iOS, Android] Add a full example
|
|
216
|
+
|
|
217
|
+
## 6. Credits
|
|
218
|
+
|
|
219
|
+
There are several plugins that are similar to this one, but all are focused on aspects of the media management experience. This plugin takes inspiration from:
|
|
220
|
+
|
|
221
|
+
- [cordova-plugin-playlist](https://github.com/Rolamix/cordova-plugin-playlist)
|
|
222
|
+
- [cordova-plugin-media](https://github.com/apache/cordova-plugin-media)
|
|
223
|
+
- [ExoMedia](https://github.com/brianwernick/ExoMedia)
|
|
224
|
+
- [PlaylistCore](https://github.com/brianwernick/PlaylistCore) (provides player controls on top of ExoMedia)
|
|
225
|
+
- [Bi-Directional AVQueuePlayer proof of concept](https://github.com/jrtaal/AVBidirectionalQueuePlayer)
|
|
226
|
+
- [cordova-music-controls-plugin](https://github.com/homerours/cordova-music-controls-plugin)
|
|
227
|
+
|
|
228
|
+
## 7. License
|
|
229
|
+
|
|
230
|
+
[The MIT License (MIT)](http://www.opensource.org/licenses/mit-license.html)
|
|
231
|
+
|
|
232
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
233
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
234
|
+
in the Software without restriction, including without limitation the rights
|
|
235
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
236
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
237
|
+
furnished to do so, subject to the following conditions:
|
|
238
|
+
|
|
239
|
+
The above copyright notice and this permission notice shall be included in
|
|
240
|
+
all copies or substantial portions of the Software.
|
|
241
|
+
|
|
242
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
243
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
244
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
245
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
246
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
247
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
248
|
+
THE SOFTWARE.
|
package/android/.project
ADDED
|
@@ -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,69 @@
|
|
|
1
|
+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
2
|
+
|
|
3
|
+
ext {
|
|
4
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
5
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
|
|
6
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
apply plugin: 'com.android.library'
|
|
10
|
+
apply plugin: 'kotlin-android'
|
|
11
|
+
|
|
12
|
+
android {
|
|
13
|
+
namespace = "org.dwbn.plugins.playlist"
|
|
14
|
+
compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
|
|
15
|
+
defaultConfig {
|
|
16
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
|
|
17
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
|
|
18
|
+
versionCode 1
|
|
19
|
+
versionName "1.0"
|
|
20
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
21
|
+
}
|
|
22
|
+
buildTypes {
|
|
23
|
+
release {
|
|
24
|
+
minifyEnabled false
|
|
25
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
lintOptions {
|
|
29
|
+
abortOnError = false
|
|
30
|
+
}
|
|
31
|
+
compileOptions {
|
|
32
|
+
sourceCompatibility JavaVersion.VERSION_21
|
|
33
|
+
targetCompatibility JavaVersion.VERSION_21
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
kotlin {
|
|
38
|
+
compilerOptions {
|
|
39
|
+
jvmTarget = JvmTarget.JVM_21
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
repositories {
|
|
44
|
+
google()
|
|
45
|
+
mavenCentral()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
dependencies {
|
|
50
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
51
|
+
implementation project(':capacitor-android')
|
|
52
|
+
testImplementation "junit:junit:$junitVersion"
|
|
53
|
+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
54
|
+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
55
|
+
implementation "androidx.core:core-ktx:1.17.0"
|
|
56
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlin_version}"
|
|
57
|
+
|
|
58
|
+
// Image Exomedia
|
|
59
|
+
implementation 'com.devbrackets.android:exomedia:5.2.0'
|
|
60
|
+
|
|
61
|
+
// Image Loading
|
|
62
|
+
implementation 'com.github.bumptech.glide:glide:5.0.5'
|
|
63
|
+
annotationProcessor 'com.github.bumptech.glide:compiler:5.0.5'
|
|
64
|
+
|
|
65
|
+
// Playlist support
|
|
66
|
+
implementation 'com.devbrackets.android:playlistcore:2.2.0'
|
|
67
|
+
implementation 'androidx.work:work-runtime-ktx:2.11.0'
|
|
68
|
+
|
|
69
|
+
}
|
|
Binary file
|
|
@@ -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
|
package/android/gradlew
ADDED
|
@@ -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" "$@"
|