@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,164 @@
1
+ /**
2
+ * Enum describing the possible errors that may come from the plugins
3
+ */
4
+ export declare enum RmxAudioErrorType {
5
+ RMXERR_NONE_ACTIVE = 0,
6
+ RMXERR_ABORTED = 1,
7
+ RMXERR_NETWORK = 2,
8
+ RMXERR_DECODE = 3,
9
+ RMXERR_NONE_SUPPORTED = 4
10
+ }
11
+ /**
12
+ * String descriptions corresponding to the RmxAudioErrorType values
13
+ */
14
+ export declare const RmxAudioErrorTypeDescriptions: string[];
15
+ /**
16
+ * Enumeration of all status messages raised by the plugin.
17
+ * NONE, REGISTER and INIT are structural and probably not useful to you.
18
+ */
19
+ export declare enum RmxAudioStatusMessage {
20
+ /**
21
+ * The starting state of the plugin. You will never see this value;
22
+ * it changes before the callbacks are even registered to report changes to this value.
23
+ */
24
+ RMXSTATUS_NONE = 0,
25
+ /**
26
+ * Raised when the plugin registers the callback handler for onStatus callbacks.
27
+ * You will probably not be able to see this (nor do you need to).
28
+ */
29
+ RMXSTATUS_REGISTER = 1,
30
+ /**
31
+ * Reserved for future use
32
+ */
33
+ RMXSTATUS_INIT = 2,
34
+ /**
35
+ * Indicates an error is reported in the 'value' field.
36
+ */
37
+ RMXSTATUS_ERROR = 5,
38
+ /**
39
+ * The reported track is being loaded by the player
40
+ */
41
+ RMXSTATUS_LOADING = 10,
42
+ /**
43
+ * The reported track is able to begin playback
44
+ */
45
+ RMXSTATUS_CANPLAY = 11,
46
+ /**
47
+ * The reported track has loaded 100% of the file (either from disc or network)
48
+ */
49
+ RMXSTATUS_LOADED = 15,
50
+ /**
51
+ * (iOS only): Playback has stalled due to insufficient network
52
+ */
53
+ RMXSTATUS_STALLED = 20,
54
+ /**
55
+ * Reports an update in the reported track's buffering status
56
+ */
57
+ RMXSTATUS_BUFFERING = 25,
58
+ /**
59
+ * The reported track has started (or resumed) playing
60
+ */
61
+ RMXSTATUS_PLAYING = 30,
62
+ /**
63
+ * The reported track has been paused, either by the user or by the system.
64
+ * (iOS only): This value is raised when MP3's are malformed (but still playable).
65
+ * These require the user to explicitly press play again. This can be worked
66
+ * around and is on the TODO list.
67
+ */
68
+ RMXSTATUS_PAUSE = 35,
69
+ /**
70
+ * Reports a change in the reported track's playback position.
71
+ */
72
+ RMXSTATUS_PLAYBACK_POSITION = 40,
73
+ /**
74
+ * The reported track has seeked.
75
+ * On Android, only the plugin consumer can generate this (Notification controls on Android do not include a seek bar).
76
+ * On iOS, the Command Center includes a seek bar so this will be reported when the user has seeked via Command Center.
77
+ */
78
+ RMXSTATUS_SEEK = 45,
79
+ /**
80
+ * The reported track has completed playback.
81
+ */
82
+ RMXSTATUS_COMPLETED = 50,
83
+ /**
84
+ * The reported track's duration has changed. This is raised once, when duration is updated for the first time.
85
+ * For streams, this value is never reported.
86
+ */
87
+ RMXSTATUS_DURATION = 55,
88
+ /**
89
+ * All playback has stopped, probably because the plugin is shutting down.
90
+ */
91
+ RMXSTATUS_STOPPED = 60,
92
+ /**
93
+ * The playlist has skipped forward to the next track.
94
+ * On both Android and iOS, this will be raised if the notification controls/Command Center were used to skip.
95
+ * It is unlikely you need to consume this event: RMXSTATUS_TRACK_CHANGED is also reported when this occurs,
96
+ * so you can generalize your track change handling in one place.
97
+ */
98
+ RMX_STATUS_SKIP_FORWARD = 90,
99
+ /**
100
+ * The playlist has skipped back to the previous track.
101
+ * On both Android and iOS, this will be raised if the notification controls/Command Center were used to skip.
102
+ * It is unlikely you need to consume this event: RMXSTATUS_TRACK_CHANGED is also reported when this occurs,
103
+ * so you can generalize your track change handling in one place.
104
+ */
105
+ RMX_STATUS_SKIP_BACK = 95,
106
+ /**
107
+ * Reported when the current track has changed in the native player. This event contains full data about
108
+ * the new track, including the index and the actual track itself. The type of the 'value' field in this case
109
+ * is OnStatusTrackChangedData.
110
+ */
111
+ RMXSTATUS_TRACK_CHANGED = 100,
112
+ /**
113
+ * The entire playlist has completed playback.
114
+ * After this event has been raised, the current item is set to null and the current index to -1.
115
+ */
116
+ RMXSTATUS_PLAYLIST_COMPLETED = 105,
117
+ /**
118
+ * An item has been added to the playlist. For the setPlaylistItems and addAllItems methods, this status is
119
+ * raised once for every track in the collection.
120
+ */
121
+ RMXSTATUS_ITEM_ADDED = 110,
122
+ /**
123
+ * An item has been removed from the playlist. For the removeItems and clearAllItems methods, this status is
124
+ * raised once for every track that was removed.
125
+ */
126
+ RMXSTATUS_ITEM_REMOVED = 115,
127
+ /**
128
+ * All items have been removed from the playlist
129
+ */
130
+ RMXSTATUS_PLAYLIST_CLEARED = 120,
131
+ /**
132
+ * Just for testing.. you don't need this and in fact can never receive it, the plugin is destroyed before it can be raised.
133
+ */
134
+ RMXSTATUS_VIEWDISAPPEAR = 200
135
+ }
136
+ /**
137
+ * String descriptions corresponding to the RmxAudioStatusMessage values
138
+ */
139
+ export declare const RmxAudioStatusMessageDescriptions: {
140
+ 0: string;
141
+ 1: string;
142
+ 2: string;
143
+ 5: string;
144
+ 10: string;
145
+ 11: string;
146
+ 15: string;
147
+ 20: string;
148
+ 25: string;
149
+ 30: string;
150
+ 35: string;
151
+ 40: string;
152
+ 45: string;
153
+ 50: string;
154
+ 55: string;
155
+ 60: string;
156
+ 90: string;
157
+ 95: string;
158
+ 100: string;
159
+ 105: string;
160
+ 110: string;
161
+ 115: string;
162
+ 120: string;
163
+ 200: string;
164
+ };
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Enum describing the possible errors that may come from the plugins
3
+ */
4
+ export var RmxAudioErrorType;
5
+ (function (RmxAudioErrorType) {
6
+ RmxAudioErrorType[RmxAudioErrorType["RMXERR_NONE_ACTIVE"] = 0] = "RMXERR_NONE_ACTIVE";
7
+ RmxAudioErrorType[RmxAudioErrorType["RMXERR_ABORTED"] = 1] = "RMXERR_ABORTED";
8
+ RmxAudioErrorType[RmxAudioErrorType["RMXERR_NETWORK"] = 2] = "RMXERR_NETWORK";
9
+ RmxAudioErrorType[RmxAudioErrorType["RMXERR_DECODE"] = 3] = "RMXERR_DECODE";
10
+ RmxAudioErrorType[RmxAudioErrorType["RMXERR_NONE_SUPPORTED"] = 4] = "RMXERR_NONE_SUPPORTED";
11
+ })(RmxAudioErrorType || (RmxAudioErrorType = {}));
12
+ ;
13
+ /**
14
+ * String descriptions corresponding to the RmxAudioErrorType values
15
+ */
16
+ export const RmxAudioErrorTypeDescriptions = [
17
+ 'No Active Sources',
18
+ 'Aborted',
19
+ 'Network',
20
+ 'Failed to Decode',
21
+ 'No Supported Sources',
22
+ ];
23
+ /**
24
+ * Enumeration of all status messages raised by the plugin.
25
+ * NONE, REGISTER and INIT are structural and probably not useful to you.
26
+ */
27
+ export var RmxAudioStatusMessage;
28
+ (function (RmxAudioStatusMessage) {
29
+ /**
30
+ * The starting state of the plugin. You will never see this value;
31
+ * it changes before the callbacks are even registered to report changes to this value.
32
+ */
33
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_NONE"] = 0] = "RMXSTATUS_NONE";
34
+ /**
35
+ * Raised when the plugin registers the callback handler for onStatus callbacks.
36
+ * You will probably not be able to see this (nor do you need to).
37
+ */
38
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_REGISTER"] = 1] = "RMXSTATUS_REGISTER";
39
+ /**
40
+ * Reserved for future use
41
+ */
42
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_INIT"] = 2] = "RMXSTATUS_INIT";
43
+ /**
44
+ * Indicates an error is reported in the 'value' field.
45
+ */
46
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_ERROR"] = 5] = "RMXSTATUS_ERROR";
47
+ /**
48
+ * The reported track is being loaded by the player
49
+ */
50
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_LOADING"] = 10] = "RMXSTATUS_LOADING";
51
+ /**
52
+ * The reported track is able to begin playback
53
+ */
54
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_CANPLAY"] = 11] = "RMXSTATUS_CANPLAY";
55
+ /**
56
+ * The reported track has loaded 100% of the file (either from disc or network)
57
+ */
58
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_LOADED"] = 15] = "RMXSTATUS_LOADED";
59
+ /**
60
+ * (iOS only): Playback has stalled due to insufficient network
61
+ */
62
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_STALLED"] = 20] = "RMXSTATUS_STALLED";
63
+ /**
64
+ * Reports an update in the reported track's buffering status
65
+ */
66
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_BUFFERING"] = 25] = "RMXSTATUS_BUFFERING";
67
+ /**
68
+ * The reported track has started (or resumed) playing
69
+ */
70
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_PLAYING"] = 30] = "RMXSTATUS_PLAYING";
71
+ /**
72
+ * The reported track has been paused, either by the user or by the system.
73
+ * (iOS only): This value is raised when MP3's are malformed (but still playable).
74
+ * These require the user to explicitly press play again. This can be worked
75
+ * around and is on the TODO list.
76
+ */
77
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_PAUSE"] = 35] = "RMXSTATUS_PAUSE";
78
+ /**
79
+ * Reports a change in the reported track's playback position.
80
+ */
81
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_PLAYBACK_POSITION"] = 40] = "RMXSTATUS_PLAYBACK_POSITION";
82
+ /**
83
+ * The reported track has seeked.
84
+ * On Android, only the plugin consumer can generate this (Notification controls on Android do not include a seek bar).
85
+ * On iOS, the Command Center includes a seek bar so this will be reported when the user has seeked via Command Center.
86
+ */
87
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_SEEK"] = 45] = "RMXSTATUS_SEEK";
88
+ /**
89
+ * The reported track has completed playback.
90
+ */
91
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_COMPLETED"] = 50] = "RMXSTATUS_COMPLETED";
92
+ /**
93
+ * The reported track's duration has changed. This is raised once, when duration is updated for the first time.
94
+ * For streams, this value is never reported.
95
+ */
96
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_DURATION"] = 55] = "RMXSTATUS_DURATION";
97
+ /**
98
+ * All playback has stopped, probably because the plugin is shutting down.
99
+ */
100
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_STOPPED"] = 60] = "RMXSTATUS_STOPPED";
101
+ /**
102
+ * The playlist has skipped forward to the next track.
103
+ * On both Android and iOS, this will be raised if the notification controls/Command Center were used to skip.
104
+ * It is unlikely you need to consume this event: RMXSTATUS_TRACK_CHANGED is also reported when this occurs,
105
+ * so you can generalize your track change handling in one place.
106
+ */
107
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMX_STATUS_SKIP_FORWARD"] = 90] = "RMX_STATUS_SKIP_FORWARD";
108
+ /**
109
+ * The playlist has skipped back to the previous track.
110
+ * On both Android and iOS, this will be raised if the notification controls/Command Center were used to skip.
111
+ * It is unlikely you need to consume this event: RMXSTATUS_TRACK_CHANGED is also reported when this occurs,
112
+ * so you can generalize your track change handling in one place.
113
+ */
114
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMX_STATUS_SKIP_BACK"] = 95] = "RMX_STATUS_SKIP_BACK";
115
+ /**
116
+ * Reported when the current track has changed in the native player. This event contains full data about
117
+ * the new track, including the index and the actual track itself. The type of the 'value' field in this case
118
+ * is OnStatusTrackChangedData.
119
+ */
120
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_TRACK_CHANGED"] = 100] = "RMXSTATUS_TRACK_CHANGED";
121
+ /**
122
+ * The entire playlist has completed playback.
123
+ * After this event has been raised, the current item is set to null and the current index to -1.
124
+ */
125
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_PLAYLIST_COMPLETED"] = 105] = "RMXSTATUS_PLAYLIST_COMPLETED";
126
+ /**
127
+ * An item has been added to the playlist. For the setPlaylistItems and addAllItems methods, this status is
128
+ * raised once for every track in the collection.
129
+ */
130
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_ITEM_ADDED"] = 110] = "RMXSTATUS_ITEM_ADDED";
131
+ /**
132
+ * An item has been removed from the playlist. For the removeItems and clearAllItems methods, this status is
133
+ * raised once for every track that was removed.
134
+ */
135
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_ITEM_REMOVED"] = 115] = "RMXSTATUS_ITEM_REMOVED";
136
+ /**
137
+ * All items have been removed from the playlist
138
+ */
139
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_PLAYLIST_CLEARED"] = 120] = "RMXSTATUS_PLAYLIST_CLEARED";
140
+ /**
141
+ * Just for testing.. you don't need this and in fact can never receive it, the plugin is destroyed before it can be raised.
142
+ */
143
+ RmxAudioStatusMessage[RmxAudioStatusMessage["RMXSTATUS_VIEWDISAPPEAR"] = 200] = "RMXSTATUS_VIEWDISAPPEAR";
144
+ })(RmxAudioStatusMessage || (RmxAudioStatusMessage = {}));
145
+ ;
146
+ /**
147
+ * String descriptions corresponding to the RmxAudioStatusMessage values
148
+ */
149
+ export const RmxAudioStatusMessageDescriptions = {
150
+ 0: 'No Status',
151
+ 1: 'Plugin Registered',
152
+ 2: 'Plugin Initialized',
153
+ 5: 'Error',
154
+ 10: 'Loading',
155
+ 11: 'CanPlay',
156
+ 15: 'Loaded',
157
+ 20: 'Stalled',
158
+ 25: 'Buffering',
159
+ 30: 'Playing',
160
+ 35: 'Paused',
161
+ 40: 'Playback Position Changed',
162
+ 45: 'Seeked',
163
+ 50: 'Playback Completed',
164
+ 55: 'Duration Changed',
165
+ 60: 'Stopped',
166
+ 90: 'Skip Forward',
167
+ 95: 'Skip Backward',
168
+ 100: 'Track Changed',
169
+ 105: 'Playlist Completed',
170
+ 110: 'Track Added',
171
+ 115: 'Track Removed',
172
+ 120: 'Playlist Cleared',
173
+ 200: 'DEBUG_View_Disappeared',
174
+ };
175
+ //# sourceMappingURL=Constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/Constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,iBAMX;AAND,WAAY,iBAAiB;IACzB,qFAAsB,CAAA;IACtB,6EAAkB,CAAA;IAClB,6EAAkB,CAAA;IAClB,2EAAiB,CAAA;IACjB,2FAAyB,CAAA;AAC7B,CAAC,EANW,iBAAiB,KAAjB,iBAAiB,QAM5B;AAAA,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IACzC,mBAAmB;IACnB,SAAS;IACT,SAAS;IACT,kBAAkB;IAClB,sBAAsB;CACzB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAN,IAAY,qBAuHX;AAvHD,WAAY,qBAAqB;IAC7B;;;OAGG;IACH,qFAAkB,CAAA;IAClB;;;OAGG;IACH,6FAAsB,CAAA;IACtB;;OAEG;IACH,qFAAkB,CAAA;IAClB;;OAEG;IACH,uFAAmB,CAAA;IAEnB;;OAEG;IACH,4FAAsB,CAAA;IACtB;;OAEG;IACH,4FAAsB,CAAA;IACtB;;OAEG;IACH,0FAAqB,CAAA;IACrB;;OAEG;IACH,4FAAsB,CAAA;IACtB;;OAEG;IACH,gGAAwB,CAAA;IACxB;;OAEG;IACH,4FAAsB,CAAA;IACtB;;;;;OAKG;IACH,wFAAoB,CAAA;IACpB;;OAEG;IACH,gHAAgC,CAAA;IAChC;;;;OAIG;IACH,sFAAmB,CAAA;IACnB;;OAEG;IACH,gGAAwB,CAAA;IACxB;;;OAGG;IACH,8FAAuB,CAAA;IACvB;;OAEG;IACH,4FAAsB,CAAA;IAEtB;;;;;OAKG;IACH,wGAA4B,CAAA;IAC5B;;;;;OAKG;IACH,kGAAyB,CAAA;IACzB;;;;OAIG;IACH,yGAA6B,CAAA;IAC7B;;;OAGG;IACH,mHAAkC,CAAA;IAClC;;;OAGG;IACH,mGAA0B,CAAA;IAC1B;;;OAGG;IACH,uGAA4B,CAAA;IAC5B;;OAEG;IACH,+GAAgC,CAAA;IAEhC;;OAEG;IACH,yGAA6B,CAAA;AACjC,CAAC,EAvHW,qBAAqB,KAArB,qBAAqB,QAuHhC;AAAA,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC7C,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,mBAAmB;IACtB,CAAC,EAAE,oBAAoB;IACvB,CAAC,EAAE,OAAO;IAEV,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,2BAA2B;IAC/B,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,oBAAoB;IACxB,EAAE,EAAE,kBAAkB;IACtB,EAAE,EAAE,SAAS;IAEb,EAAE,EAAE,cAAc;IAClB,EAAE,EAAE,eAAe;IACnB,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,oBAAoB;IACzB,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,kBAAkB;IAEvB,GAAG,EAAE,wBAAwB;CAChC,CAAC"}
@@ -0,0 +1,181 @@
1
+ import { RmxAudioStatusMessage } from './Constants';
2
+ import { AudioPlayerEventHandler, AudioPlayerEventHandlers, AudioPlayerOptions, AudioTrack, AudioTrackRemoval, OnStatusCallback, OnStatusCallbackUpdateData, OnStatusErrorCallbackData, OnStatusTrackChangedData, PlaylistItemOptions } from './interfaces';
3
+ export declare class RmxAudioPlayer {
4
+ handlers: AudioPlayerEventHandlers;
5
+ options: AudioPlayerOptions;
6
+ private readonly _initPromise;
7
+ private _readyResolve;
8
+ private _readyReject;
9
+ private _currentState;
10
+ private _hasError;
11
+ private _hasLoaded;
12
+ private _currentItem;
13
+ /**
14
+ * The current summarized state of the player, as a string. It is preferred that you use the 'isX' accessors,
15
+ * because they properly interpret the range of these values, but this field is exposed if you wish to observe
16
+ * or interrogate it.
17
+ */
18
+ get currentState(): "error" | "stopped" | "unknown" | "paused" | "loading" | "playing" | "ready";
19
+ get currentTrack(): AudioTrack | null;
20
+ /**
21
+ * If the playlist is currently playling a track.
22
+ */
23
+ get isPlaying(): boolean;
24
+ /**
25
+ * True if the playlist is currently paused
26
+ */
27
+ get isPaused(): boolean;
28
+ /**
29
+ * True if the plugin is currently loading its *current* track.
30
+ * On iOS, many tracks are loaded in parallel, so this only reports for the *current item*, e.g.
31
+ * the item that will begin playback if you press pause.
32
+ * If you need track-specific data, it is better to watch the onStatus stream and watch for RMXSTATUS_LOADING,
33
+ * which will be raised independently & simultaneously for every track in the playlist.
34
+ * On Android, tracks are only loaded as they begin playback, so this value and RMXSTATUS_LOADING should always
35
+ * apply to the same track.
36
+ */
37
+ get isLoading(): boolean;
38
+ /**
39
+ * True if the *currently playing track* has been loaded and can be played (this includes if it is *currently playing*).
40
+ */
41
+ get hasLoaded(): boolean;
42
+ /**
43
+ * True if the *current track* has reported an error. In almost all cases,
44
+ * the playlist will automatically skip forward to the next track, in which case you will also receive
45
+ * an RMXSTATUS_TRACK_CHANGED event.
46
+ */
47
+ get hasError(): boolean;
48
+ /**
49
+ * Creates a new RmxAudioPlayer instance.
50
+ */
51
+ constructor();
52
+ /**
53
+ * Player interface
54
+ */
55
+ /**
56
+ * Returns a promise that resolves when the plugin is ready.
57
+ */
58
+ ready: () => Promise<void>;
59
+ initialize: () => Promise<void>;
60
+ /**
61
+ * Sets the player options. This can be called at any time and is not required before playback can be initiated.
62
+ */
63
+ setOptions: (options: AudioPlayerOptions) => Promise<void>;
64
+ /**
65
+ * Playlist item management
66
+ */
67
+ /**
68
+ * Sets the entire list of tracks to be played by the playlist.
69
+ * This will clear all previous items from the playlist.
70
+ * If you pass options.retainPosition = true, the current playback position will be
71
+ * recorded and used when playback restarts. This can be used, for example, to set the
72
+ * playlist to a new set of tracks, but retain the currently-playing item to avoid skipping.
73
+ */
74
+ setPlaylistItems: (items: AudioTrack[], options?: PlaylistItemOptions) => Promise<void>;
75
+ /**
76
+ * Add a single track to the end of the playlist
77
+ */
78
+ addItem: (trackItem: AudioTrack) => Promise<void>;
79
+ /**
80
+ * Adds the list of tracks to the end of the playlist.
81
+ */
82
+ addAllItems: (items: AudioTrack[]) => Promise<void>;
83
+ /**
84
+ * Removes a track from the playlist. If this is the currently playing item, the next item will automatically begin playback.
85
+ */
86
+ removeItem: (removeItem: AudioTrackRemoval) => Promise<void>;
87
+ /**
88
+ * Removes all given tracks from the playlist; these can be specified either by trackId or trackIndex. If the removed items
89
+ * include the currently playing item, the next available item will automatically begin playing.
90
+ */
91
+ removeItems: (items: AudioTrackRemoval[]) => Promise<void>;
92
+ /**
93
+ * Clear the entire playlist. This will result in the STOPPED event being raised.
94
+ */
95
+ clearAllItems: () => Promise<void>;
96
+ /**
97
+ * Playback management
98
+ */
99
+ /**
100
+ * Begin playback. If no tracks have been added, this has no effect.
101
+ */
102
+ play: () => Promise<void>;
103
+ /**
104
+ * Play the track at the given index. If the track does not exist, this has no effect.
105
+ */
106
+ playTrackByIndex: (index: number, position?: number) => Promise<void>;
107
+ /**
108
+ * Play the track matching the given trackId. If the track does not exist, this has no effect.
109
+ */
110
+ playTrackById: (id: string, position?: number) => Promise<void>;
111
+ /**
112
+ * Play the track matching the given trackId. If the track does not exist, this has no effect.
113
+ */
114
+ selectTrackByIndex: (index: number, position?: number) => Promise<void>;
115
+ /**
116
+ * Play the track matching the given trackId. If the track does not exist, this has no effect.
117
+ */
118
+ selectTrackById: (id: string, position?: number) => Promise<void>;
119
+ /**
120
+ * Pause playback
121
+ */
122
+ pause: () => Promise<void>;
123
+ /**
124
+ * Skip to the next track. If you are already at the end, and loop is false, this has no effect.
125
+ * If you are at the end, and loop is true, playback will begin at the beginning of the playlist.
126
+ */
127
+ skipForward: () => Promise<void>;
128
+ /**
129
+ * Skip to the previous track. If you are already at the beginning, this has no effect.
130
+ */
131
+ skipBack: () => Promise<void>;
132
+ /**
133
+ * Seek to the given position in the currently playing track. If the value exceeds the track length,
134
+ * the track will complete and playback of the next track will begin.
135
+ */
136
+ seekTo: (position: number) => Promise<void>;
137
+ /**
138
+ * Set the playback speed; a float value between [-1, 1] inclusive. If set to 0, this pauses playback.
139
+ */
140
+ setPlaybackRate: (rate: number) => Promise<void>;
141
+ /**
142
+ * Set the playback volume. Float value between [0, 1] inclusive.
143
+ * On both Android and iOS, this sets the volume of the media stream, which can be externally
144
+ * controlled by setting the overall hardware volume.
145
+ */
146
+ setVolume: (volume: number) => Promise<void>;
147
+ /**
148
+ * Sets a flag indicating whether the playlist should loop back to the beginning once it reaches the end.
149
+ */
150
+ setLoop: (loop: boolean) => Promise<void>;
151
+ /**
152
+ * Status event handling
153
+ */
154
+ /**
155
+ * @internal
156
+ * Call this function to emit an onStatus event via the on('status') handler.
157
+ * Internal use only, to raise events received from the native interface.
158
+ */
159
+ protected onStatus(trackId: string, type: RmxAudioStatusMessage, value: OnStatusCallbackUpdateData | OnStatusTrackChangedData | OnStatusErrorCallbackData): void;
160
+ /**
161
+ * Subscribe to events raised by the plugin, e.g. on('status', (data) => { ... }),
162
+ * For now, only 'status' is supported.
163
+ *
164
+ * @param eventName Name of event to subscribe to.
165
+ * @param callback The callback function to receive the event data
166
+ */
167
+ on(eventName: 'status', callback: OnStatusCallback): void;
168
+ /**
169
+ * Remove an event handler from the plugin
170
+ * @param eventName The name of the event whose subscription is to be removed
171
+ * @param handle The event handler to destroy. Ensure that this is the SAME INSTANCE as the handler
172
+ * that was passed in to create the subscription!
173
+ */
174
+ off(eventName: string, handle: AudioPlayerEventHandler): void;
175
+ /**
176
+ * @internal
177
+ * Raises an event via the corresponding event handler. Internal use only.
178
+ * @param args Event args to pass through to the handler.
179
+ */
180
+ protected emit(...args: any[]): boolean;
181
+ }