@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.
Files changed (90) hide show
  1. package/CapacitorPluginPlaylist.podspec +17 -0
  2. package/README.md +248 -0
  3. package/android/.project +34 -0
  4. package/android/build.gradle +69 -0
  5. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  6. package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  7. package/android/gradle.properties +22 -0
  8. package/android/gradlew +251 -0
  9. package/android/gradlew.bat +94 -0
  10. package/android/proguard-rules.pro +21 -0
  11. package/android/settings.gradle +2 -0
  12. package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +26 -0
  13. package/android/src/main/AndroidManifest.xml +4 -0
  14. package/android/src/main/java/org/dwbn/plugins/playlist/App.kt +19 -0
  15. package/android/src/main/java/org/dwbn/plugins/playlist/FakeR.kt +39 -0
  16. package/android/src/main/java/org/dwbn/plugins/playlist/OnStatusCallback.kt +34 -0
  17. package/android/src/main/java/org/dwbn/plugins/playlist/OnStatusReportListener.java +7 -0
  18. package/android/src/main/java/org/dwbn/plugins/playlist/PlaylistItemOptions.java +52 -0
  19. package/android/src/main/java/org/dwbn/plugins/playlist/PlaylistPlugin.kt +447 -0
  20. package/android/src/main/java/org/dwbn/plugins/playlist/RmxAudioErrorType.java +13 -0
  21. package/android/src/main/java/org/dwbn/plugins/playlist/RmxAudioPlayer.java +487 -0
  22. package/android/src/main/java/org/dwbn/plugins/playlist/RmxAudioStatusMessage.java +35 -0
  23. package/android/src/main/java/org/dwbn/plugins/playlist/RmxConstants.java +42 -0
  24. package/android/src/main/java/org/dwbn/plugins/playlist/TrackRemovalItem.java +12 -0
  25. package/android/src/main/java/org/dwbn/plugins/playlist/data/AudioTrack.kt +94 -0
  26. package/android/src/main/java/org/dwbn/plugins/playlist/manager/MediaControlsListener.kt +13 -0
  27. package/android/src/main/java/org/dwbn/plugins/playlist/manager/Options.kt +77 -0
  28. package/android/src/main/java/org/dwbn/plugins/playlist/manager/PlaylistManager.kt +308 -0
  29. package/android/src/main/java/org/dwbn/plugins/playlist/notification/PlaylistNotificationProvider.kt +26 -0
  30. package/android/src/main/java/org/dwbn/plugins/playlist/playlist/AudioApi.kt +114 -0
  31. package/android/src/main/java/org/dwbn/plugins/playlist/playlist/AudioPlaylistHandler.java +146 -0
  32. package/android/src/main/java/org/dwbn/plugins/playlist/playlist/BaseMediaApi.kt +36 -0
  33. package/android/src/main/java/org/dwbn/plugins/playlist/service/MediaImageProvider.kt +83 -0
  34. package/android/src/main/java/org/dwbn/plugins/playlist/service/MediaService.kt +98 -0
  35. package/android/src/main/res/.gitkeep +0 -0
  36. package/android/src/main/res/drawable/ic_closed_caption_white_24dp.xml +9 -0
  37. package/android/src/main/res/drawable/ic_demo_icon_adaptive.xml +15 -0
  38. package/android/src/main/res/drawable/ic_launcher_background.xml +48 -0
  39. package/android/src/main/res/drawable/ic_launcher_foreground.xml +22 -0
  40. package/android/src/main/res/drawable/ic_notification_icon.png +0 -0
  41. package/android/src/main/res/layout/bridge_layout_main.xml +15 -0
  42. package/android/src/main/res/values/colors.xml +3 -0
  43. package/android/src/main/res/values/strings.xml +3 -0
  44. package/android/src/main/res/values/styles.xml +3 -0
  45. package/android/src/test/java/com/getcapacitor/ExampleUnitTest.java +18 -0
  46. package/dist/docs.json +2071 -0
  47. package/dist/esm/Constants.d.ts +164 -0
  48. package/dist/esm/Constants.js +175 -0
  49. package/dist/esm/Constants.js.map +1 -0
  50. package/dist/esm/RmxAudioPlayer.d.ts +181 -0
  51. package/dist/esm/RmxAudioPlayer.js +344 -0
  52. package/dist/esm/RmxAudioPlayer.js.map +1 -0
  53. package/dist/esm/definitions.d.ts +78 -0
  54. package/dist/esm/definitions.js +2 -0
  55. package/dist/esm/definitions.js.map +1 -0
  56. package/dist/esm/index.d.ts +5 -0
  57. package/dist/esm/index.js +6 -0
  58. package/dist/esm/index.js.map +1 -0
  59. package/dist/esm/interfaces.d.ts +246 -0
  60. package/dist/esm/interfaces.js +2 -0
  61. package/dist/esm/interfaces.js.map +1 -0
  62. package/dist/esm/plugin.d.ts +3 -0
  63. package/dist/esm/plugin.js +13 -0
  64. package/dist/esm/plugin.js.map +1 -0
  65. package/dist/esm/utils.d.ts +15 -0
  66. package/dist/esm/utils.js +48 -0
  67. package/dist/esm/utils.js.map +1 -0
  68. package/dist/esm/web.d.ts +54 -0
  69. package/dist/esm/web.js +409 -0
  70. package/dist/esm/web.js.map +1 -0
  71. package/dist/plugin.cjs.js +993 -0
  72. package/dist/plugin.cjs.js.map +1 -0
  73. package/dist/plugin.js +996 -0
  74. package/dist/plugin.js.map +1 -0
  75. package/ios/Plugin/AVBidirectionalQueuePlayer.swift +269 -0
  76. package/ios/Plugin/AudioTrack.swift +63 -0
  77. package/ios/Plugin/Constants.swift +39 -0
  78. package/ios/Plugin/DispatchQueue.swift +47 -0
  79. package/ios/Plugin/Info.plist +24 -0
  80. package/ios/Plugin/Plugin.h +10 -0
  81. package/ios/Plugin/Plugin.m +30 -0
  82. package/ios/Plugin/Plugin.swift +208 -0
  83. package/ios/Plugin/RmxAudioPlayer.swift +1150 -0
  84. package/ios/Plugin.xcodeproj/project.pbxproj +574 -0
  85. package/ios/Plugin.xcworkspace/contents.xcworkspacedata +10 -0
  86. package/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  87. package/ios/PluginTests/Info.plist +22 -0
  88. package/ios/PluginTests/PluginTests.swift +35 -0
  89. package/ios/Podfile +16 -0
  90. package/package.json +89 -0
@@ -0,0 +1,344 @@
1
+ import { RmxAudioStatusMessage, RmxAudioStatusMessageDescriptions } from './Constants';
2
+ import { Playlist } from './plugin';
3
+ import { validateTrack, validateTracks } from './utils';
4
+ /*!
5
+ * Module dependencies.
6
+ */
7
+ const itemStatusChangeTypes = [
8
+ RmxAudioStatusMessage.RMXSTATUS_PLAYBACK_POSITION,
9
+ RmxAudioStatusMessage.RMXSTATUS_DURATION,
10
+ RmxAudioStatusMessage.RMXSTATUS_BUFFERING,
11
+ RmxAudioStatusMessage.RMXSTATUS_CANPLAY,
12
+ RmxAudioStatusMessage.RMXSTATUS_LOADING,
13
+ RmxAudioStatusMessage.RMXSTATUS_LOADED,
14
+ RmxAudioStatusMessage.RMXSTATUS_PAUSE,
15
+ RmxAudioStatusMessage.RMXSTATUS_COMPLETED,
16
+ RmxAudioStatusMessage.RMXSTATUS_ERROR,
17
+ ];
18
+ export class RmxAudioPlayer {
19
+ /**
20
+ * The current summarized state of the player, as a string. It is preferred that you use the 'isX' accessors,
21
+ * because they properly interpret the range of these values, but this field is exposed if you wish to observe
22
+ * or interrogate it.
23
+ */
24
+ get currentState() {
25
+ return this._currentState;
26
+ }
27
+ get currentTrack() {
28
+ return this._currentItem;
29
+ }
30
+ /**
31
+ * If the playlist is currently playling a track.
32
+ */
33
+ get isPlaying() {
34
+ return this._currentState === 'playing';
35
+ }
36
+ /**
37
+ * True if the playlist is currently paused
38
+ */
39
+ get isPaused() {
40
+ return this._currentState === 'paused' || this._currentState === 'stopped';
41
+ }
42
+ /**
43
+ * True if the plugin is currently loading its *current* track.
44
+ * On iOS, many tracks are loaded in parallel, so this only reports for the *current item*, e.g.
45
+ * the item that will begin playback if you press pause.
46
+ * If you need track-specific data, it is better to watch the onStatus stream and watch for RMXSTATUS_LOADING,
47
+ * which will be raised independently & simultaneously for every track in the playlist.
48
+ * On Android, tracks are only loaded as they begin playback, so this value and RMXSTATUS_LOADING should always
49
+ * apply to the same track.
50
+ */
51
+ get isLoading() {
52
+ return this._currentState === 'loading';
53
+ }
54
+ /**
55
+ * True if the *currently playing track* has been loaded and can be played (this includes if it is *currently playing*).
56
+ */
57
+ get hasLoaded() {
58
+ return this._hasLoaded;
59
+ }
60
+ /**
61
+ * True if the *current track* has reported an error. In almost all cases,
62
+ * the playlist will automatically skip forward to the next track, in which case you will also receive
63
+ * an RMXSTATUS_TRACK_CHANGED event.
64
+ */
65
+ get hasError() {
66
+ return this._hasError;
67
+ }
68
+ /**
69
+ * Creates a new RmxAudioPlayer instance.
70
+ */
71
+ constructor() {
72
+ this.handlers = {};
73
+ this.options = { verbose: false, resetStreamOnPause: true };
74
+ this._readyResolve = () => {
75
+ };
76
+ this._readyReject = () => {
77
+ };
78
+ this._currentState = 'unknown';
79
+ this._hasError = false;
80
+ this._hasLoaded = false;
81
+ this._currentItem = null;
82
+ /**
83
+ * Player interface
84
+ */
85
+ /**
86
+ * Returns a promise that resolves when the plugin is ready.
87
+ */
88
+ this.ready = () => {
89
+ return this._initPromise;
90
+ };
91
+ this.initialize = async () => {
92
+ Playlist.addListener('status', (data) => {
93
+ if (data.action === 'status') {
94
+ this.onStatus(data.status.trackId, data.status.msgType, data.status.value);
95
+ }
96
+ else {
97
+ console.warn('Unknown audio player onStatus message:', data);
98
+ }
99
+ });
100
+ try {
101
+ await Playlist.initialize();
102
+ this._readyResolve();
103
+ }
104
+ catch (args) {
105
+ const message = 'Capacitor RMXAUDIOPLAYER: Error initializing:';
106
+ console.warn(message, args);
107
+ this._readyReject();
108
+ }
109
+ };
110
+ /**
111
+ * Sets the player options. This can be called at any time and is not required before playback can be initiated.
112
+ */
113
+ this.setOptions = (options) => {
114
+ this.options = Object.assign(Object.assign({}, this.options), options);
115
+ return Playlist.setOptions(this.options);
116
+ };
117
+ /**
118
+ * Playlist item management
119
+ */
120
+ /**
121
+ * Sets the entire list of tracks to be played by the playlist.
122
+ * This will clear all previous items from the playlist.
123
+ * If you pass options.retainPosition = true, the current playback position will be
124
+ * recorded and used when playback restarts. This can be used, for example, to set the
125
+ * playlist to a new set of tracks, but retain the currently-playing item to avoid skipping.
126
+ */
127
+ this.setPlaylistItems = (items, options) => {
128
+ return Playlist.setPlaylistItems({ items: validateTracks(items), options: options || {} });
129
+ };
130
+ /**
131
+ * Add a single track to the end of the playlist
132
+ */
133
+ this.addItem = (trackItem) => {
134
+ const validTrackItem = validateTrack(trackItem);
135
+ if (!validTrackItem) {
136
+ throw new Error('Provided track is null or not an audio track');
137
+ }
138
+ return Playlist.addItem({ item: validTrackItem });
139
+ };
140
+ /**
141
+ * Adds the list of tracks to the end of the playlist.
142
+ */
143
+ this.addAllItems = (items) => {
144
+ return Playlist.addAllItems({ items: validateTracks(items) });
145
+ };
146
+ /**
147
+ * Removes a track from the playlist. If this is the currently playing item, the next item will automatically begin playback.
148
+ */
149
+ this.removeItem = (removeItem) => {
150
+ if (!removeItem) {
151
+ throw new Error('Track removal spec is empty');
152
+ }
153
+ if (!removeItem.trackId && removeItem.trackIndex === undefined) {
154
+ throw new Error('Track removal spec is invalid');
155
+ }
156
+ return Playlist.removeItem({
157
+ id: removeItem.trackId,
158
+ index: removeItem.trackIndex
159
+ });
160
+ };
161
+ /**
162
+ * Removes all given tracks from the playlist; these can be specified either by trackId or trackIndex. If the removed items
163
+ * include the currently playing item, the next available item will automatically begin playing.
164
+ */
165
+ this.removeItems = (items) => {
166
+ return Playlist.removeItems({
167
+ items: (items || []).map((item) => ({
168
+ id: item === null || item === void 0 ? void 0 : item.trackId,
169
+ index: item === null || item === void 0 ? void 0 : item.trackIndex
170
+ }))
171
+ });
172
+ };
173
+ /**
174
+ * Clear the entire playlist. This will result in the STOPPED event being raised.
175
+ */
176
+ this.clearAllItems = () => {
177
+ return Playlist.clearAllItems();
178
+ };
179
+ /**
180
+ * Playback management
181
+ */
182
+ /**
183
+ * Begin playback. If no tracks have been added, this has no effect.
184
+ */
185
+ this.play = () => {
186
+ return Playlist.play();
187
+ };
188
+ /**
189
+ * Play the track at the given index. If the track does not exist, this has no effect.
190
+ */
191
+ this.playTrackByIndex = (index, position) => {
192
+ return Playlist.playTrackByIndex({ index, position: position || 0 });
193
+ };
194
+ /**
195
+ * Play the track matching the given trackId. If the track does not exist, this has no effect.
196
+ */
197
+ this.playTrackById = (id, position) => {
198
+ return Playlist.playTrackById({ id, position: position || 0 });
199
+ };
200
+ /**
201
+ * Play the track matching the given trackId. If the track does not exist, this has no effect.
202
+ */
203
+ this.selectTrackByIndex = (index, position) => {
204
+ return Playlist.selectTrackByIndex({ index, position: position || 0 });
205
+ };
206
+ /**
207
+ * Play the track matching the given trackId. If the track does not exist, this has no effect.
208
+ */
209
+ this.selectTrackById = (id, position) => {
210
+ return Playlist.selectTrackById({ id, position: position || 0 });
211
+ };
212
+ /**
213
+ * Pause playback
214
+ */
215
+ this.pause = () => {
216
+ return Playlist.pause();
217
+ };
218
+ /**
219
+ * Skip to the next track. If you are already at the end, and loop is false, this has no effect.
220
+ * If you are at the end, and loop is true, playback will begin at the beginning of the playlist.
221
+ */
222
+ this.skipForward = () => {
223
+ return Playlist.skipForward();
224
+ };
225
+ /**
226
+ * Skip to the previous track. If you are already at the beginning, this has no effect.
227
+ */
228
+ this.skipBack = () => {
229
+ return Playlist.skipBack();
230
+ };
231
+ /**
232
+ * Seek to the given position in the currently playing track. If the value exceeds the track length,
233
+ * the track will complete and playback of the next track will begin.
234
+ */
235
+ this.seekTo = (position) => {
236
+ return Playlist.seekTo({ position });
237
+ };
238
+ /**
239
+ * Set the playback speed; a float value between [-1, 1] inclusive. If set to 0, this pauses playback.
240
+ */
241
+ this.setPlaybackRate = (rate) => {
242
+ return Playlist.setPlaybackRate({ rate });
243
+ };
244
+ /**
245
+ * Set the playback volume. Float value between [0, 1] inclusive.
246
+ * On both Android and iOS, this sets the volume of the media stream, which can be externally
247
+ * controlled by setting the overall hardware volume.
248
+ */
249
+ this.setVolume = (volume) => {
250
+ return Playlist.setPlaybackVolume({ volume });
251
+ };
252
+ /**
253
+ * Sets a flag indicating whether the playlist should loop back to the beginning once it reaches the end.
254
+ */
255
+ this.setLoop = (loop) => {
256
+ return Playlist.setLoop({ loop: loop });
257
+ };
258
+ this.handlers = {};
259
+ new Promise((resolve) => {
260
+ window.addEventListener('beforeunload', () => resolve(), { once: true });
261
+ }).then(() => Playlist.release());
262
+ this._initPromise = new Promise((resolve, reject) => {
263
+ this._readyResolve = resolve;
264
+ this._readyReject = reject;
265
+ });
266
+ }
267
+ /**
268
+ * Status event handling
269
+ */
270
+ /**
271
+ * @internal
272
+ * Call this function to emit an onStatus event via the on('status') handler.
273
+ * Internal use only, to raise events received from the native interface.
274
+ */
275
+ onStatus(trackId, type, value) {
276
+ var _a;
277
+ const status = { msgType: type, trackId: trackId, value: value };
278
+ if (this.options.verbose) {
279
+ console.debug(`RmxAudioPlayer.onStatus: ${RmxAudioStatusMessageDescriptions[type]}(${type}) [${trackId}]: `, value);
280
+ }
281
+ if (status.msgType === RmxAudioStatusMessage.RMXSTATUS_TRACK_CHANGED) {
282
+ this._hasError = false;
283
+ this._hasLoaded = false;
284
+ this._currentState = 'loading';
285
+ this._currentItem = (_a = status.value) === null || _a === void 0 ? void 0 : _a.currentItem;
286
+ }
287
+ // The plugin's status changes only in response to specific events.
288
+ if (itemStatusChangeTypes.indexOf(status.msgType) >= 0) {
289
+ // Only change the plugin's *current status* if the event being raised is for the current active track.
290
+ if (this._currentItem && this._currentItem.trackId === trackId) {
291
+ if (status.value && status.value.status) {
292
+ this._currentState = status.value.status;
293
+ }
294
+ if (status.msgType === RmxAudioStatusMessage.RMXSTATUS_CANPLAY) {
295
+ this._hasLoaded = true;
296
+ }
297
+ if (status.msgType === RmxAudioStatusMessage.RMXSTATUS_ERROR) {
298
+ this._hasError = true;
299
+ }
300
+ }
301
+ }
302
+ this.emit('status', status);
303
+ }
304
+ on(eventName, callback) {
305
+ if (!Object.prototype.hasOwnProperty.call(this.handlers, eventName)) {
306
+ this.handlers[eventName] = [];
307
+ }
308
+ this.handlers[eventName].push(callback);
309
+ }
310
+ /**
311
+ * Remove an event handler from the plugin
312
+ * @param eventName The name of the event whose subscription is to be removed
313
+ * @param handle The event handler to destroy. Ensure that this is the SAME INSTANCE as the handler
314
+ * that was passed in to create the subscription!
315
+ */
316
+ off(eventName, handle) {
317
+ if (Object.prototype.hasOwnProperty.call(this.handlers, eventName)) {
318
+ const handleIndex = this.handlers[eventName].indexOf(handle);
319
+ if (handleIndex >= 0) {
320
+ this.handlers[eventName].splice(handleIndex, 1);
321
+ }
322
+ }
323
+ }
324
+ /**
325
+ * @internal
326
+ * Raises an event via the corresponding event handler. Internal use only.
327
+ * @param args Event args to pass through to the handler.
328
+ */
329
+ emit(...args) {
330
+ const eventName = args.shift();
331
+ if (!Object.prototype.hasOwnProperty.call(this.handlers, eventName)) {
332
+ return false;
333
+ }
334
+ const handler = this.handlers[eventName];
335
+ for (let i = 0; i < handler.length; i++) {
336
+ const callback = this.handlers[eventName][i];
337
+ if (typeof callback === 'function') {
338
+ callback(...args);
339
+ }
340
+ }
341
+ return true;
342
+ }
343
+ }
344
+ //# sourceMappingURL=RmxAudioPlayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RmxAudioPlayer.js","sourceRoot":"","sources":["../../src/RmxAudioPlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,iCAAiC,EACpC,MAAM,aAAa,CAAC;AAgBrB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGxD;;GAEG;AAEH,MAAM,qBAAqB,GAAG;IAC1B,qBAAqB,CAAC,2BAA2B;IACjD,qBAAqB,CAAC,kBAAkB;IACxC,qBAAqB,CAAC,mBAAmB;IACzC,qBAAqB,CAAC,iBAAiB;IACvC,qBAAqB,CAAC,iBAAiB;IACvC,qBAAqB,CAAC,gBAAgB;IACtC,qBAAqB,CAAC,eAAe;IACrC,qBAAqB,CAAC,mBAAmB;IACzC,qBAAqB,CAAC,eAAe;CACxC,CAAC;AAEF,MAAM,OAAO,cAAc;IAevB;;;;OAIG;IACH,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,C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"}
@@ -0,0 +1,78 @@
1
+ import { PluginListenerHandle } from '@capacitor/core';
2
+ import { AudioPlayerOptions, AudioTrack, PlaylistItemOptions, PlaylistStatusChangeCallback } from './interfaces';
3
+ export interface PlaylistPlugin {
4
+ /**
5
+ * Listen for screen reader state change (on/off)
6
+ */
7
+ addListener(eventName: 'status', listenerFunc: PlaylistStatusChangeCallback): Promise<PluginListenerHandle>;
8
+ setOptions(options: AudioPlayerOptions): Promise<void>;
9
+ initialize(): Promise<void>;
10
+ release(): Promise<void>;
11
+ setPlaylistItems(options: PlaylistOptions): Promise<void>;
12
+ addItem(options: AddItemOptions): Promise<void>;
13
+ addAllItems(options: AddAllItemOptions): Promise<void>;
14
+ removeItem(options: RemoveItemOptions): Promise<void>;
15
+ removeItems(options: RemoveItemsOptions): Promise<void>;
16
+ clearAllItems(): Promise<void>;
17
+ getPlaylist(): Promise<GetPlaylistResult>;
18
+ play(): Promise<void>;
19
+ pause(): Promise<void>;
20
+ skipForward(): Promise<void>;
21
+ skipBack(): Promise<void>;
22
+ seekTo(options: SeekToOptions): Promise<void>;
23
+ playTrackByIndex(options: PlayByIndexOptions): Promise<void>;
24
+ playTrackById(options: PlayByIdOptions): Promise<void>;
25
+ selectTrackByIndex(options: SelectByIndexOptions): Promise<void>;
26
+ selectTrackById(options: SelectByIdOptions): Promise<void>;
27
+ setPlaybackVolume(options: SetPlaybackVolumeOptions): Promise<void>;
28
+ setLoop(options: SetLoopOptions): Promise<void>;
29
+ setPlaybackRate(options: SetPlaybackRateOptions): Promise<void>;
30
+ }
31
+ export interface PlaylistOptions {
32
+ items: Array<AudioTrack>;
33
+ options: PlaylistItemOptions;
34
+ }
35
+ export interface AddItemOptions {
36
+ item: AudioTrack;
37
+ }
38
+ export interface AddAllItemOptions {
39
+ items: Array<AudioTrack>;
40
+ }
41
+ export interface RemoveItemOptions {
42
+ id?: string;
43
+ index?: number;
44
+ }
45
+ export interface RemoveItemsOptions {
46
+ items: Array<RemoveItemOptions>;
47
+ }
48
+ export interface SeekToOptions {
49
+ position: number;
50
+ }
51
+ export interface PlayByIndexOptions {
52
+ index: number;
53
+ position?: number;
54
+ }
55
+ export interface PlayByIdOptions {
56
+ id: string;
57
+ position?: number;
58
+ }
59
+ export interface SelectByIndexOptions {
60
+ index: number;
61
+ position?: number;
62
+ }
63
+ export interface SelectByIdOptions {
64
+ id: string;
65
+ position?: number;
66
+ }
67
+ export interface SetPlaybackVolumeOptions {
68
+ volume: number;
69
+ }
70
+ export interface SetLoopOptions {
71
+ loop: boolean;
72
+ }
73
+ export interface SetPlaybackRateOptions {
74
+ rate: number;
75
+ }
76
+ export interface GetPlaylistResult {
77
+ items: Array<AudioTrack>;
78
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export * from './definitions';
2
+ export * from './interfaces';
3
+ export * from './Constants';
4
+ export * from './RmxAudioPlayer';
5
+ export * from './plugin';
@@ -0,0 +1,6 @@
1
+ export * from './definitions';
2
+ export * from './interfaces';
3
+ export * from './Constants';
4
+ export * from './RmxAudioPlayer';
5
+ export * from './plugin';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC"}