@amazon-devices/kepler-media-controls 1.0.17

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 (36) hide show
  1. package/LICENSE +7 -0
  2. package/SystemBundles/ccb7cf3a42fbe7b00b72ad1b7cc41cb45c8c491032e9dfe359f1830234d5d040.bundle +2277 -0
  3. package/SystemBundles/ccb7cf3a42fbe7b00b72ad1b7cc41cb45c8c491032e9dfe359f1830234d5d040.bundle.map +1 -0
  4. package/SystemModules/amzn__kepler-media-controls.modules.txt +10 -0
  5. package/SystemModules/amzn__kepler-media-controls.private.modules.txt +21 -0
  6. package/SystemModules/keplerscript-system-bundle-config.json +7 -0
  7. package/THIRD_PARTY_NOTICES.txt +12224 -0
  8. package/dist/MediaControlClientAsync.d.ts +226 -0
  9. package/dist/MediaControlClientAsync.js +355 -0
  10. package/dist/MediaControlComponentAsync.d.ts +8 -0
  11. package/dist/MediaControlComponentAsync.js +26 -0
  12. package/dist/MediaControlEndpointLocatorAsync.d.ts +19 -0
  13. package/dist/MediaControlEndpointLocatorAsync.js +70 -0
  14. package/dist/MediaControlServer.d.ts +37 -0
  15. package/dist/MediaControlServer.js +218 -0
  16. package/dist/MediaControlServerComponentAsync.d.ts +7 -0
  17. package/dist/MediaControlServerComponentAsync.js +29 -0
  18. package/dist/index.d.ts +3 -0
  19. package/dist/index.js +25 -0
  20. package/dist/kepler/tm-manifest.json +1 -0
  21. package/dist/turbo-modules/KeplerMediaControlsClientTM.d.ts +50 -0
  22. package/dist/turbo-modules/KeplerMediaControlsClientTM.js +18 -0
  23. package/dist/turbo-modules/KeplerMediaControlsServerTM.d.ts +17 -0
  24. package/dist/turbo-modules/KeplerMediaControlsServerTM.js +18 -0
  25. package/dist/turbo-modules/__mocks__/KeplerMediaControlsClientTM.d.ts +6 -0
  26. package/dist/turbo-modules/__mocks__/KeplerMediaControlsClientTM.js +7 -0
  27. package/dist/turbo-modules/__mocks__/KeplerMediaControlsServerTM.d.ts +7 -0
  28. package/dist/turbo-modules/__mocks__/KeplerMediaControlsServerTM.js +8 -0
  29. package/dist/turbo-modules/types/KeplerMediaControlsTypes.d.ts +859 -0
  30. package/dist/turbo-modules/types/KeplerMediaControlsTypes.js +152 -0
  31. package/dist/turbo-modules/types/index.d.ts +2 -0
  32. package/dist/turbo-modules/types/index.js +20 -0
  33. package/kepler-compatibility.json +13 -0
  34. package/kepler-transformed-package-info.json +3 -0
  35. package/package.json +1 -0
  36. package/react-native.config.js +22 -0
@@ -0,0 +1,226 @@
1
+ import { NativeClient } from './turbo-modules/KeplerMediaControlsClientTM';
2
+ import * as MediaControlTypes from './turbo-modules/types';
3
+ import { MediaId } from '@amazon-devices/kepler-media-types';
4
+ /**
5
+ * Class representing a client for a media control endpoint. This class is used
6
+ * to interact with the media control endpoint and perform various actions such
7
+ * as play, pause, seek, and more.
8
+ */
9
+ export declare class MediaControlClientAsync implements MediaControlTypes.IMediaControlClientAsync {
10
+ readonly client: NativeClient;
11
+ readonly emptySession: MediaControlTypes.IMediaSessionId;
12
+ constructor(client: NativeClient);
13
+ /**
14
+ * Get the package id of this endpoint if any
15
+ * @returns @type {Promise} of @type {MediaControlTypes.IPackageId} the id
16
+ * of the endpoint's package
17
+ */
18
+ getEndpointPackageId(): MediaControlTypes.IPackageId;
19
+ /**
20
+ * Send a play request to this media control endpoint
21
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
22
+ * to send the request for
23
+ * @returns @type {Promise} of @type {void} which resolves on a successful
24
+ * request, and rejects with an error otherwise
25
+ */
26
+ play(session?: MediaControlTypes.IMediaSessionId): Promise<void>;
27
+ /**
28
+ * Send a pause request to this media control endpoint
29
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
30
+ * to send the request for
31
+ * @returns @type {Promise} of @type {void} which resolves on a successful
32
+ * request, and rejects with an error otherwise
33
+ */
34
+ pause(session?: MediaControlTypes.IMediaSessionId): Promise<void>;
35
+ /**
36
+ * Send a toggle play pause request to this media control endpoint
37
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
38
+ * to send the request for
39
+ * @returns @type {Promise} of @type {void} which resolves on a successful
40
+ * request, and rejects with an error otherwise
41
+ */
42
+ togglePlayPause(session?: MediaControlTypes.IMediaSessionId): Promise<void>;
43
+ /**
44
+ * Send a stop request to this media control endpoint
45
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
46
+ * to send the request for
47
+ * @returns @type {Promise} of @type {void} which resolves on a successful
48
+ * request, and rejects with an error otherwise
49
+ */
50
+ stop(session?: MediaControlTypes.IMediaSessionId): Promise<void>;
51
+ /**
52
+ * Send a start over request to this media control endpoint
53
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
54
+ * to send the request for
55
+ * @returns @type {Promise} of @type {void} which resolves on a successful
56
+ * request, and rejects with an error otherwise
57
+ */
58
+ startOver(session?: MediaControlTypes.IMediaSessionId): Promise<void>;
59
+ /**
60
+ * Send a fast forward request to this media control endpoint
61
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
62
+ * to send the request for
63
+ * @returns @type {Promise} of @type {void} which resolves on a successful
64
+ * request, and rejects with an error otherwise
65
+ */
66
+ fastForward(session?: MediaControlTypes.IMediaSessionId): Promise<void>;
67
+ /**
68
+ * Send a rewind request to this media control endpoint
69
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
70
+ * to send the request for
71
+ * @returns @type {Promise} of @type {void} which resolves on a successful
72
+ * request, and rejects with an error otherwise
73
+ */
74
+ rewind(session?: MediaControlTypes.IMediaSessionId): Promise<void>;
75
+ /**
76
+ * Send a set playback speed request to this media control endpoint
77
+ * @param speed @type {number} the speed to set the playback to
78
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
79
+ * to send the request for
80
+ * @returns @type {Promise} of @type {void} which resolves on a successful
81
+ * request, and rejects with an error otherwise
82
+ */
83
+ setPlaybackSpeed(speed: number, session?: MediaControlTypes.IMediaSessionId): Promise<void>;
84
+ /**
85
+ * Send a skip forward request to this media control endpoint
86
+ * @param delta @type {MediaControlTypes.ITimeValue} the delta to skip forward by
87
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
88
+ * to send the request for
89
+ * @returns @type {Promise} of @type {void} which resolves on a successful
90
+ * request, and rejects with an error otherwise
91
+ */
92
+ skipForward(delta: MediaControlTypes.ITimeValue, session?: MediaControlTypes.IMediaSessionId): Promise<void>;
93
+ /**
94
+ * Send a skip backward request to this media control endpoint
95
+ * @param delta @type {MediaControlTypes.ITimeValue} the delta to skip backward by
96
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
97
+ * to send the request for
98
+ * @returns @type {Promise} of @type {void} which resolves on a successful
99
+ * request, and rejects with an error otherwise
100
+ */
101
+ skipBackward(delta: MediaControlTypes.ITimeValue, session?: MediaControlTypes.IMediaSessionId): Promise<void>;
102
+ /**
103
+ * Send a seek request to this media control endpoint
104
+ * @param position @type {MediaControlTypes.ITimeValue} the position to seek to
105
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
106
+ * to send the request for
107
+ * @returns @type {Promise} of @type {void} which resolves on a successful
108
+ * request, and rejects with an error otherwise
109
+ */
110
+ seek(position: MediaControlTypes.ITimeValue, session?: MediaControlTypes.IMediaSessionId): Promise<void>;
111
+ /**
112
+ * Send a set audio volume request to this media control endpoint
113
+ * @param volume @type {number} the volume to set the audio to
114
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
115
+ * to send the request for
116
+ * @returns @type {Promise} of @type {void} which resolves on a successful
117
+ * request, and rejects with an error otherwise
118
+ */
119
+ setAudioVolume(volume: number, session?: MediaControlTypes.IMediaSessionId): Promise<void>;
120
+ /**
121
+ * Send a set audio track request to this media control endpoint
122
+ * @param audioTrack @type {MediaControlTypes.ITrack} the audio track to set
123
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
124
+ * to send the request for
125
+ * @returns @type {Promise} of @type {void} which resolves on a successful
126
+ * request, and rejects with an error otherwise
127
+ */
128
+ setAudioTrack(audioTrack: MediaControlTypes.ITrack, session?: MediaControlTypes.IMediaSessionId): Promise<void>;
129
+ /**
130
+ * Send an enable text track request to this media control endpoint
131
+ * @param textTrack @type {MediaControlTypes.ITrack} the text track to enable
132
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
133
+ * to send the request for
134
+ * @returns @type {Promise} of @type {void} which resolves on a successful
135
+ * request, and rejects with an error otherwise
136
+ */
137
+ enableTextTrack(textTrack: MediaControlTypes.ITrack, session?: MediaControlTypes.IMediaSessionId): Promise<void>;
138
+ /**
139
+ * Send a disable text track request to this media control endpoint
140
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
141
+ * to send the request for
142
+ * @returns @type {Promise} of @type {void} which resolves on a successful
143
+ * request, and rejects with an error otherwise
144
+ */
145
+ disableTextTrack(session?: MediaControlTypes.IMediaSessionId): Promise<void>;
146
+ /**
147
+ * Send a next request to this media control endpoint
148
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
149
+ * to send the request for
150
+ * @returns @type {Promise} of @type {void} which resolves on a successful
151
+ * request, and rejects with an error otherwise
152
+ */
153
+ next(session?: MediaControlTypes.IMediaSessionId): Promise<void>;
154
+ /**
155
+ * Send a previous request to this media control endpoint
156
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
157
+ * to send the request for
158
+ * @returns @type {Promise} of @type {void} which resolves on a successful
159
+ * request, and rejects with an error otherwise
160
+ */
161
+ previous(session?: MediaControlTypes.IMediaSessionId): Promise<void>;
162
+ /**
163
+ * Send an enable shuffle request to this media control endpoint
164
+ * @param enable @type {boolean} whether to enable or disable shuffle
165
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
166
+ * to send the request for
167
+ * @returns @type {Promise} of @type {void} which resolves on a successful
168
+ * request, and rejects with an error otherwise
169
+ */
170
+ enableShuffle(enable: boolean, session?: MediaControlTypes.IMediaSessionId): Promise<void>;
171
+ /**
172
+ * Send a set repeat mode request to this media control endpoint
173
+ * @param mode @type {MediaControlTypes.RepeatMode} the repeat mode to set
174
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
175
+ * to send the request for
176
+ * @returns @type {Promise} of @type {void} which resolves on a successful
177
+ * request, and rejects with an error otherwise
178
+ */
179
+ setRepeatMode(mode: MediaControlTypes.RepeatMode, session?: MediaControlTypes.IMediaSessionId): Promise<void>;
180
+ /**
181
+ * Send a set rating request to this media control endpoint
182
+ * @param id @type {MediaId} the media id to set the rating for
183
+ * @param rating @type {number} the rating to set
184
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
185
+ * to send the request for
186
+ * @returns @type {Promise} of @type {void} which resolves on a successful
187
+ * request, and rejects with an error otherwise
188
+ */
189
+ setRating(id: MediaId, rating: number, session?: MediaControlTypes.IMediaSessionId): Promise<void>;
190
+ /**
191
+ * Send a get metadata request to this media control endpoint
192
+ * @param id @type {MediaId} the media id to get the metadata for
193
+ * @returns @type {Promise} of @type {MediaControlTypes.IMediaMetadat} which resolves with
194
+ * the metadata on a successful request and rejects with an error otherwise
195
+ */
196
+ getMetadata(id: MediaId): Promise<MediaControlTypes.IMediaMetadata>;
197
+ /**
198
+ * Send a start over request to this media control endpoint
199
+ * @param action @type {MediaControlTypes.Action} the action to send
200
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
201
+ * to send the request for
202
+ * @returns @type {Promise} of @type {void} which resolves on a successful
203
+ * request, and rejects with an error otherwise
204
+ */
205
+ sendCustomAction(action: MediaControlTypes.Action, session?: MediaControlTypes.IMediaSessionId): Promise<void>;
206
+ /**
207
+ * Get the session state for this media control endpoint
208
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
209
+ * to get the session state for. Leave null to retrieve states for all active sessions
210
+ * @returns @type {Promise} of @type {MediaControlTypes.MediaSessionState[]} which resolves with
211
+ * a list of session states on a successful request and rejects with an error otherwise
212
+ */
213
+ getSessionState(session?: MediaControlTypes.IMediaSessionId): Promise<MediaControlTypes.MediaSessionState[]>;
214
+ /**
215
+ * Add a listener to this media control endpoint
216
+ * @param listener @type {MediaControlTypes.IMediaControlListener} the listener to add
217
+ * @returns @type {Promise} of @type {MediaControlTypes.ISubscription} which resolves with
218
+ * a subscription object on a successful request and rejects with an error otherwise
219
+ */
220
+ addListener(listener: MediaControlTypes.IMediaControlListener): Promise<MediaControlTypes.ISubscription>;
221
+ /**
222
+ * Destroy this media control endpoint, releasing all assigned listeners.
223
+ * Must be called if a listener was added.
224
+ */
225
+ destroy(): void;
226
+ }
@@ -0,0 +1,355 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2024 Amazon.com, Inc. or its affiliates. All rights reserved.
4
+ *
5
+ * AMAZON PROPRIETARY/CONFIDENTIAL
6
+ *
7
+ * You may not use this file except in compliance with the terms and
8
+ * conditions set forth in the accompanying LICENSE.TXT file.
9
+ *
10
+ * THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
11
+ * DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
12
+ * IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
13
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
14
+ */
15
+ var __importDefault = (this && this.__importDefault) || function (mod) {
16
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.MediaControlClientAsync = void 0;
20
+ const KeplerMediaControlsClientTM_1 = __importDefault(require("./turbo-modules/KeplerMediaControlsClientTM"));
21
+ const KeplerMediaControlsTypes_1 = require("./turbo-modules/types/KeplerMediaControlsTypes");
22
+ if (KeplerMediaControlsClientTM_1.default === undefined || KeplerMediaControlsClientTM_1.default === null) {
23
+ throw new Error('Media Controls Client TurboModule is null');
24
+ }
25
+ const EXCEPTION_MAP = {
26
+ 'com.amazon.kepler.media.control.InvalidStateError': KeplerMediaControlsTypes_1.InvalidStateError,
27
+ 'com.amazon.kepler.media.control.NotAllowedError': KeplerMediaControlsTypes_1.NotAllowedError,
28
+ 'com.amazon.kepler.media.control.SpeedOutOfRangeError': KeplerMediaControlsTypes_1.SpeedOutOfRangeError,
29
+ 'com.amazon.kepler.media.control.SeekOutOfRangeError': KeplerMediaControlsTypes_1.SeekOutOfRangeError,
30
+ 'com.amazon.kepler.media.control.NotAvailableError': KeplerMediaControlsTypes_1.NotAvailableError
31
+ };
32
+ const isPromiseResultSuccessful = (result) => {
33
+ if (result.isSuccess === undefined || result.isSuccess === true) {
34
+ return result;
35
+ }
36
+ const MappedError = EXCEPTION_MAP[result.errorTypes] ?? Error;
37
+ throw new MappedError(result.errorMessage);
38
+ };
39
+ /**
40
+ * Class representing a susbscription to changes in a media control endpoint's
41
+ * session states. Used to remove a listener.
42
+ */
43
+ class Subscription {
44
+ token;
45
+ constructor(token) {
46
+ this.token = token;
47
+ }
48
+ /**
49
+ * Called to remove the subscription
50
+ */
51
+ unsubscribe() {
52
+ KeplerMediaControlsClientTM_1.default.removeListener(this.token);
53
+ }
54
+ }
55
+ /**
56
+ * Class representing a client for a media control endpoint. This class is used
57
+ * to interact with the media control endpoint and perform various actions such
58
+ * as play, pause, seek, and more.
59
+ */
60
+ class MediaControlClientAsync {
61
+ client;
62
+ emptySession = { id: NaN };
63
+ constructor(client) {
64
+ this.client = client;
65
+ }
66
+ /**
67
+ * Get the package id of this endpoint if any
68
+ * @returns @type {Promise} of @type {MediaControlTypes.IPackageId} the id
69
+ * of the endpoint's package
70
+ */
71
+ getEndpointPackageId() {
72
+ return KeplerMediaControlsClientTM_1.default.getEndpointPackageId(this.client.clientId);
73
+ }
74
+ /**
75
+ * Send a play request to this media control endpoint
76
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
77
+ * to send the request for
78
+ * @returns @type {Promise} of @type {void} which resolves on a successful
79
+ * request, and rejects with an error otherwise
80
+ */
81
+ async play(session) {
82
+ return await KeplerMediaControlsClientTM_1.default.play(this.client.clientId, session ?? this.emptySession)
83
+ .then((result) => isPromiseResultSuccessful(result));
84
+ }
85
+ /**
86
+ * Send a pause request to this media control endpoint
87
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
88
+ * to send the request for
89
+ * @returns @type {Promise} of @type {void} which resolves on a successful
90
+ * request, and rejects with an error otherwise
91
+ */
92
+ async pause(session) {
93
+ return await KeplerMediaControlsClientTM_1.default.pause(this.client.clientId, session ?? this.emptySession)
94
+ .then((result) => isPromiseResultSuccessful(result));
95
+ }
96
+ /**
97
+ * Send a toggle play pause request to this media control endpoint
98
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
99
+ * to send the request for
100
+ * @returns @type {Promise} of @type {void} which resolves on a successful
101
+ * request, and rejects with an error otherwise
102
+ */
103
+ async togglePlayPause(session) {
104
+ return await KeplerMediaControlsClientTM_1.default.togglePlayPause(this.client.clientId, session ?? this.emptySession)
105
+ .then((result) => isPromiseResultSuccessful(result));
106
+ }
107
+ /**
108
+ * Send a stop request to this media control endpoint
109
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
110
+ * to send the request for
111
+ * @returns @type {Promise} of @type {void} which resolves on a successful
112
+ * request, and rejects with an error otherwise
113
+ */
114
+ async stop(session) {
115
+ return await KeplerMediaControlsClientTM_1.default.stop(this.client.clientId, session ?? this.emptySession)
116
+ .then((result) => isPromiseResultSuccessful(result));
117
+ }
118
+ /**
119
+ * Send a start over request to this media control endpoint
120
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
121
+ * to send the request for
122
+ * @returns @type {Promise} of @type {void} which resolves on a successful
123
+ * request, and rejects with an error otherwise
124
+ */
125
+ async startOver(session) {
126
+ return await KeplerMediaControlsClientTM_1.default.startOver(this.client.clientId, session ?? this.emptySession)
127
+ .then((result) => isPromiseResultSuccessful(result));
128
+ }
129
+ /**
130
+ * Send a fast forward request to this media control endpoint
131
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
132
+ * to send the request for
133
+ * @returns @type {Promise} of @type {void} which resolves on a successful
134
+ * request, and rejects with an error otherwise
135
+ */
136
+ async fastForward(session) {
137
+ return await KeplerMediaControlsClientTM_1.default.fastForward(this.client.clientId, session ?? this.emptySession)
138
+ .then((result) => isPromiseResultSuccessful(result));
139
+ }
140
+ /**
141
+ * Send a rewind request to this media control endpoint
142
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
143
+ * to send the request for
144
+ * @returns @type {Promise} of @type {void} which resolves on a successful
145
+ * request, and rejects with an error otherwise
146
+ */
147
+ async rewind(session) {
148
+ return await KeplerMediaControlsClientTM_1.default.rewind(this.client.clientId, session ?? this.emptySession)
149
+ .then((result) => isPromiseResultSuccessful(result));
150
+ }
151
+ /**
152
+ * Send a set playback speed request to this media control endpoint
153
+ * @param speed @type {number} the speed to set the playback to
154
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
155
+ * to send the request for
156
+ * @returns @type {Promise} of @type {void} which resolves on a successful
157
+ * request, and rejects with an error otherwise
158
+ */
159
+ async setPlaybackSpeed(speed, session) {
160
+ return await KeplerMediaControlsClientTM_1.default.setPlaybackSpeed(this.client.clientId, speed, session ?? this.emptySession)
161
+ .then((result) => isPromiseResultSuccessful(result));
162
+ }
163
+ /**
164
+ * Send a skip forward request to this media control endpoint
165
+ * @param delta @type {MediaControlTypes.ITimeValue} the delta to skip forward by
166
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
167
+ * to send the request for
168
+ * @returns @type {Promise} of @type {void} which resolves on a successful
169
+ * request, and rejects with an error otherwise
170
+ */
171
+ async skipForward(delta, session) {
172
+ return await KeplerMediaControlsClientTM_1.default.skipForward(this.client.clientId, delta, session ?? this.emptySession)
173
+ .then((result) => isPromiseResultSuccessful(result));
174
+ }
175
+ /**
176
+ * Send a skip backward request to this media control endpoint
177
+ * @param delta @type {MediaControlTypes.ITimeValue} the delta to skip backward by
178
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
179
+ * to send the request for
180
+ * @returns @type {Promise} of @type {void} which resolves on a successful
181
+ * request, and rejects with an error otherwise
182
+ */
183
+ async skipBackward(delta, session) {
184
+ return await KeplerMediaControlsClientTM_1.default.skipBackward(this.client.clientId, delta, session ?? this.emptySession)
185
+ .then((result) => isPromiseResultSuccessful(result));
186
+ }
187
+ /**
188
+ * Send a seek request to this media control endpoint
189
+ * @param position @type {MediaControlTypes.ITimeValue} the position to seek to
190
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
191
+ * to send the request for
192
+ * @returns @type {Promise} of @type {void} which resolves on a successful
193
+ * request, and rejects with an error otherwise
194
+ */
195
+ async seek(position, session) {
196
+ return await KeplerMediaControlsClientTM_1.default.seek(this.client.clientId, position, session ?? this.emptySession)
197
+ .then((result) => isPromiseResultSuccessful(result));
198
+ }
199
+ /**
200
+ * Send a set audio volume request to this media control endpoint
201
+ * @param volume @type {number} the volume to set the audio to
202
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
203
+ * to send the request for
204
+ * @returns @type {Promise} of @type {void} which resolves on a successful
205
+ * request, and rejects with an error otherwise
206
+ */
207
+ async setAudioVolume(volume, session) {
208
+ return await KeplerMediaControlsClientTM_1.default.setAudioVolume(this.client.clientId, volume, session ?? this.emptySession)
209
+ .then((result) => isPromiseResultSuccessful(result));
210
+ }
211
+ /**
212
+ * Send a set audio track request to this media control endpoint
213
+ * @param audioTrack @type {MediaControlTypes.ITrack} the audio track to set
214
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
215
+ * to send the request for
216
+ * @returns @type {Promise} of @type {void} which resolves on a successful
217
+ * request, and rejects with an error otherwise
218
+ */
219
+ async setAudioTrack(audioTrack, session) {
220
+ return await KeplerMediaControlsClientTM_1.default.setAudioTrack(this.client.clientId, audioTrack, session ?? this.emptySession)
221
+ .then((result) => isPromiseResultSuccessful(result));
222
+ }
223
+ /**
224
+ * Send an enable text track request to this media control endpoint
225
+ * @param textTrack @type {MediaControlTypes.ITrack} the text track to enable
226
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
227
+ * to send the request for
228
+ * @returns @type {Promise} of @type {void} which resolves on a successful
229
+ * request, and rejects with an error otherwise
230
+ */
231
+ async enableTextTrack(textTrack, session) {
232
+ return await KeplerMediaControlsClientTM_1.default.enableTextTrack(this.client.clientId, textTrack, session ?? this.emptySession)
233
+ .then((result) => isPromiseResultSuccessful(result));
234
+ }
235
+ /**
236
+ * Send a disable text track request to this media control endpoint
237
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
238
+ * to send the request for
239
+ * @returns @type {Promise} of @type {void} which resolves on a successful
240
+ * request, and rejects with an error otherwise
241
+ */
242
+ async disableTextTrack(session) {
243
+ return await KeplerMediaControlsClientTM_1.default.disableTextTrack(this.client.clientId, session ?? this.emptySession)
244
+ .then((result) => isPromiseResultSuccessful(result));
245
+ }
246
+ /**
247
+ * Send a next request to this media control endpoint
248
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
249
+ * to send the request for
250
+ * @returns @type {Promise} of @type {void} which resolves on a successful
251
+ * request, and rejects with an error otherwise
252
+ */
253
+ async next(session) {
254
+ return await KeplerMediaControlsClientTM_1.default.next(this.client.clientId, session ?? this.emptySession)
255
+ .then((result) => isPromiseResultSuccessful(result));
256
+ }
257
+ /**
258
+ * Send a previous request to this media control endpoint
259
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
260
+ * to send the request for
261
+ * @returns @type {Promise} of @type {void} which resolves on a successful
262
+ * request, and rejects with an error otherwise
263
+ */
264
+ async previous(session) {
265
+ return await KeplerMediaControlsClientTM_1.default.previous(this.client.clientId, session ?? this.emptySession)
266
+ .then((result) => isPromiseResultSuccessful(result));
267
+ }
268
+ /**
269
+ * Send an enable shuffle request to this media control endpoint
270
+ * @param enable @type {boolean} whether to enable or disable shuffle
271
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
272
+ * to send the request for
273
+ * @returns @type {Promise} of @type {void} which resolves on a successful
274
+ * request, and rejects with an error otherwise
275
+ */
276
+ async enableShuffle(enable, session) {
277
+ return await KeplerMediaControlsClientTM_1.default.enableShuffle(this.client.clientId, enable, session ?? this.emptySession)
278
+ .then((result) => isPromiseResultSuccessful(result));
279
+ }
280
+ /**
281
+ * Send a set repeat mode request to this media control endpoint
282
+ * @param mode @type {MediaControlTypes.RepeatMode} the repeat mode to set
283
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
284
+ * to send the request for
285
+ * @returns @type {Promise} of @type {void} which resolves on a successful
286
+ * request, and rejects with an error otherwise
287
+ */
288
+ async setRepeatMode(mode, session) {
289
+ return await KeplerMediaControlsClientTM_1.default.setRepeatMode(this.client.clientId, mode, session ?? this.emptySession)
290
+ .then((result) => isPromiseResultSuccessful(result));
291
+ }
292
+ /**
293
+ * Send a set rating request to this media control endpoint
294
+ * @param id @type {MediaId} the media id to set the rating for
295
+ * @param rating @type {number} the rating to set
296
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
297
+ * to send the request for
298
+ * @returns @type {Promise} of @type {void} which resolves on a successful
299
+ * request, and rejects with an error otherwise
300
+ */
301
+ async setRating(id, rating, session) {
302
+ return await KeplerMediaControlsClientTM_1.default.setRating(this.client.clientId, id, rating, session ?? this.emptySession)
303
+ .then((result) => isPromiseResultSuccessful(result));
304
+ }
305
+ /**
306
+ * Send a get metadata request to this media control endpoint
307
+ * @param id @type {MediaId} the media id to get the metadata for
308
+ * @returns @type {Promise} of @type {MediaControlTypes.IMediaMetadat} which resolves with
309
+ * the metadata on a successful request and rejects with an error otherwise
310
+ */
311
+ async getMetadata(id) {
312
+ return await KeplerMediaControlsClientTM_1.default.getMetadata(this.client.clientId, id);
313
+ }
314
+ /**
315
+ * Send a start over request to this media control endpoint
316
+ * @param action @type {MediaControlTypes.Action} the action to send
317
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
318
+ * to send the request for
319
+ * @returns @type {Promise} of @type {void} which resolves on a successful
320
+ * request, and rejects with an error otherwise
321
+ */
322
+ async sendCustomAction(action, session) {
323
+ return await KeplerMediaControlsClientTM_1.default.sendCustomAction(this.client.clientId, action, session ?? this.emptySession)
324
+ .then((result) => isPromiseResultSuccessful(result));
325
+ }
326
+ /**
327
+ * Get the session state for this media control endpoint
328
+ * @param session @type {MediaControlTypes.IMediaSessionId} the session id
329
+ * to get the session state for. Leave null to retrieve states for all active sessions
330
+ * @returns @type {Promise} of @type {MediaControlTypes.MediaSessionState[]} which resolves with
331
+ * a list of session states on a successful request and rejects with an error otherwise
332
+ */
333
+ async getSessionState(session) {
334
+ return await KeplerMediaControlsClientTM_1.default.getSessionState(this.client.clientId, session ?? this.emptySession)
335
+ .then((result) => isPromiseResultSuccessful(result));
336
+ }
337
+ /**
338
+ * Add a listener to this media control endpoint
339
+ * @param listener @type {MediaControlTypes.IMediaControlListener} the listener to add
340
+ * @returns @type {Promise} of @type {MediaControlTypes.ISubscription} which resolves with
341
+ * a subscription object on a successful request and rejects with an error otherwise
342
+ */
343
+ async addListener(listener) {
344
+ return await KeplerMediaControlsClientTM_1.default.addListener(this.client.clientId, listener.onStateChanged)
345
+ .then((token) => new Subscription(token));
346
+ }
347
+ /**
348
+ * Destroy this media control endpoint, releasing all assigned listeners.
349
+ * Must be called if a listener was added.
350
+ */
351
+ destroy() {
352
+ KeplerMediaControlsClientTM_1.default.destroy(this.client.clientId);
353
+ }
354
+ }
355
+ exports.MediaControlClientAsync = MediaControlClientAsync;
@@ -0,0 +1,8 @@
1
+ import { IMediaControlEndpointLocatorAsync } from './turbo-modules/types';
2
+ /**
3
+ * This class is used to obtain an instance of the MediaControlEndpointLocatorAsync class.
4
+ */
5
+ export declare const MediaControlComponentAsync: {
6
+ makeMediaControlEndpointLocator(): IMediaControlEndpointLocatorAsync;
7
+ };
8
+ export default MediaControlComponentAsync;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2024 Amazon.com, Inc. or its affiliates. All rights reserved.
4
+ *
5
+ * AMAZON PROPRIETARY/CONFIDENTIAL
6
+ *
7
+ * You may not use this file except in compliance with the terms and
8
+ * conditions set forth in the accompanying LICENSE.TXT file.
9
+ *
10
+ * THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
11
+ * DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
12
+ * IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
13
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.MediaControlComponentAsync = void 0;
17
+ const MediaControlEndpointLocatorAsync_1 = require("./MediaControlEndpointLocatorAsync");
18
+ /**
19
+ * This class is used to obtain an instance of the MediaControlEndpointLocatorAsync class.
20
+ */
21
+ exports.MediaControlComponentAsync = {
22
+ makeMediaControlEndpointLocator() {
23
+ return new MediaControlEndpointLocatorAsync_1.MediaControlEndpointLocatorAsync();
24
+ }
25
+ };
26
+ exports.default = exports.MediaControlComponentAsync;
@@ -0,0 +1,19 @@
1
+ import * as MediaControlTypes from './turbo-modules/types';
2
+ /**
3
+ * MediaControlEndpointLocatorAsync class used to locate media control endpoints
4
+ */
5
+ export declare class MediaControlEndpointLocatorAsync implements MediaControlTypes.IMediaControlEndpointLocatorAsync {
6
+ /**
7
+ * Call to obtain a list of media control clients
8
+ * @returns @type {Promise} of @type {MediaControlTypes.IMediaControlClientAsync[]} containing
9
+ * clients to interact with all available media control endpoints
10
+ */
11
+ getMediaControlEndpoints(): Promise<MediaControlTypes.IMediaControlClientAsync[]>;
12
+ /**
13
+ * Subscribes a listener to any changes in the list of control endpoints
14
+ * @param listener @type {MediaControlTypes.IMediaControlEndpointLocatorListener}
15
+ * @returns @type {Promise} of @type {MediaControlTypes.ISubscription} which can be used
16
+ * to remove the listener
17
+ */
18
+ addChangeListener(listener: MediaControlTypes.IMediaControlEndpointLocatorListener): Promise<MediaControlTypes.ISubscription>;
19
+ }