@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.
- package/LICENSE +7 -0
- package/SystemBundles/ccb7cf3a42fbe7b00b72ad1b7cc41cb45c8c491032e9dfe359f1830234d5d040.bundle +2277 -0
- package/SystemBundles/ccb7cf3a42fbe7b00b72ad1b7cc41cb45c8c491032e9dfe359f1830234d5d040.bundle.map +1 -0
- package/SystemModules/amzn__kepler-media-controls.modules.txt +10 -0
- package/SystemModules/amzn__kepler-media-controls.private.modules.txt +21 -0
- package/SystemModules/keplerscript-system-bundle-config.json +7 -0
- package/THIRD_PARTY_NOTICES.txt +12224 -0
- package/dist/MediaControlClientAsync.d.ts +226 -0
- package/dist/MediaControlClientAsync.js +355 -0
- package/dist/MediaControlComponentAsync.d.ts +8 -0
- package/dist/MediaControlComponentAsync.js +26 -0
- package/dist/MediaControlEndpointLocatorAsync.d.ts +19 -0
- package/dist/MediaControlEndpointLocatorAsync.js +70 -0
- package/dist/MediaControlServer.d.ts +37 -0
- package/dist/MediaControlServer.js +218 -0
- package/dist/MediaControlServerComponentAsync.d.ts +7 -0
- package/dist/MediaControlServerComponentAsync.js +29 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +25 -0
- package/dist/kepler/tm-manifest.json +1 -0
- package/dist/turbo-modules/KeplerMediaControlsClientTM.d.ts +50 -0
- package/dist/turbo-modules/KeplerMediaControlsClientTM.js +18 -0
- package/dist/turbo-modules/KeplerMediaControlsServerTM.d.ts +17 -0
- package/dist/turbo-modules/KeplerMediaControlsServerTM.js +18 -0
- package/dist/turbo-modules/__mocks__/KeplerMediaControlsClientTM.d.ts +6 -0
- package/dist/turbo-modules/__mocks__/KeplerMediaControlsClientTM.js +7 -0
- package/dist/turbo-modules/__mocks__/KeplerMediaControlsServerTM.d.ts +7 -0
- package/dist/turbo-modules/__mocks__/KeplerMediaControlsServerTM.js +8 -0
- package/dist/turbo-modules/types/KeplerMediaControlsTypes.d.ts +859 -0
- package/dist/turbo-modules/types/KeplerMediaControlsTypes.js +152 -0
- package/dist/turbo-modules/types/index.d.ts +2 -0
- package/dist/turbo-modules/types/index.js +20 -0
- package/kepler-compatibility.json +13 -0
- package/kepler-transformed-package-info.json +3 -0
- package/package.json +1 -0
- package/react-native.config.js +22 -0
|
@@ -0,0 +1,70 @@
|
|
|
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.MediaControlEndpointLocatorAsync = void 0;
|
|
20
|
+
const KeplerMediaControlsClientTM_1 = __importDefault(require("./turbo-modules/KeplerMediaControlsClientTM"));
|
|
21
|
+
const MediaControlClientAsync_1 = require("./MediaControlClientAsync");
|
|
22
|
+
if (KeplerMediaControlsClientTM_1.default === undefined || KeplerMediaControlsClientTM_1.default === null) {
|
|
23
|
+
throw new Error('Media Controls Client TurboModule is null');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Class to represent a subscription to a listener from the endpoint locator changes.
|
|
27
|
+
* Used to remove a listener.
|
|
28
|
+
*/
|
|
29
|
+
class Subscription {
|
|
30
|
+
token;
|
|
31
|
+
constructor(token) {
|
|
32
|
+
this.token = token;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* called to unsubscribe the listener from the endpoint locator changes
|
|
36
|
+
*/
|
|
37
|
+
unsubscribe() {
|
|
38
|
+
KeplerMediaControlsClientTM_1.default.removeChangeListener(this.token);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* MediaControlEndpointLocatorAsync class used to locate media control endpoints
|
|
43
|
+
*/
|
|
44
|
+
class MediaControlEndpointLocatorAsync {
|
|
45
|
+
/**
|
|
46
|
+
* Call to obtain a list of media control clients
|
|
47
|
+
* @returns @type {Promise} of @type {MediaControlTypes.IMediaControlClientAsync[]} containing
|
|
48
|
+
* clients to interact with all available media control endpoints
|
|
49
|
+
*/
|
|
50
|
+
async getMediaControlEndpoints() {
|
|
51
|
+
return await KeplerMediaControlsClientTM_1.default.getMediaControlEndpoints().then((endpoints) => {
|
|
52
|
+
const clients = endpoints.map((endpoint) => new MediaControlClientAsync_1.MediaControlClientAsync(endpoint));
|
|
53
|
+
return clients;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Subscribes a listener to any changes in the list of control endpoints
|
|
58
|
+
* @param listener @type {MediaControlTypes.IMediaControlEndpointLocatorListener}
|
|
59
|
+
* @returns @type {Promise} of @type {MediaControlTypes.ISubscription} which can be used
|
|
60
|
+
* to remove the listener
|
|
61
|
+
*/
|
|
62
|
+
async addChangeListener(listener) {
|
|
63
|
+
return await new Promise((resolve) => {
|
|
64
|
+
KeplerMediaControlsClientTM_1.default.addChangeListener(listener.onEndpointsChanged).then((token) => {
|
|
65
|
+
resolve(new Subscription(token));
|
|
66
|
+
}).catch((error) => error);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.MediaControlEndpointLocatorAsync = MediaControlEndpointLocatorAsync;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as KeplerMediaControlsTypes from './turbo-modules/types';
|
|
2
|
+
import { IComponentInstance } from '@amazon-devices/react-native-kepler';
|
|
3
|
+
import { IMediaControlServerAsync } from './turbo-modules/types/KeplerMediaControlsTypes';
|
|
4
|
+
/**
|
|
5
|
+
* The entry point for KMC server side APIs. Provides the ability to register handlers
|
|
6
|
+
* and update media session states
|
|
7
|
+
*/
|
|
8
|
+
export declare class MediaControlServer implements IMediaControlServerAsync {
|
|
9
|
+
/**
|
|
10
|
+
* Get the major version number of the TM interface
|
|
11
|
+
* @returns @type {number} the major version
|
|
12
|
+
*/
|
|
13
|
+
static getMajorVersion(): number;
|
|
14
|
+
/**
|
|
15
|
+
* Get the minor version number of the TM interface
|
|
16
|
+
* @returns @type {number} the minor version
|
|
17
|
+
*/
|
|
18
|
+
static getMinorVersion(): number;
|
|
19
|
+
/**
|
|
20
|
+
* Get the patch version number of the TM interface
|
|
21
|
+
* @returns @type {number} the patch version
|
|
22
|
+
*/
|
|
23
|
+
static getPatchVersion(): number;
|
|
24
|
+
/**
|
|
25
|
+
* Set the event handlers associated with the provided component
|
|
26
|
+
* @param handler @type {KeplerMediaControlsTypes.IMediaControlHandlerAsync} Object containing
|
|
27
|
+
* the event handlers
|
|
28
|
+
* @param componentInstance @type {IComponentInstance} The component instance for which
|
|
29
|
+
* the handlers are being set
|
|
30
|
+
*/
|
|
31
|
+
setHandlerForComponent(handler: KeplerMediaControlsTypes.IMediaControlHandlerAsync, componentInstance: IComponentInstance): void;
|
|
32
|
+
/**
|
|
33
|
+
* Update the media session states
|
|
34
|
+
* @param states @type {KeplerMediaControlsTypes.MediaSessionState[]} Array of media session states
|
|
35
|
+
*/
|
|
36
|
+
updateMediaSessionStates(states: KeplerMediaControlsTypes.MediaSessionState[]): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2024-2025 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.MediaControlServer = void 0;
|
|
20
|
+
const KeplerMediaControlsServerTM_1 = __importDefault(require("./turbo-modules/KeplerMediaControlsServerTM"));
|
|
21
|
+
if (KeplerMediaControlsServerTM_1.default === undefined || KeplerMediaControlsServerTM_1.default === null) {
|
|
22
|
+
throw new Error('Media Controls TurboModule is null');
|
|
23
|
+
}
|
|
24
|
+
function normalizeError(error) {
|
|
25
|
+
if (error instanceof Error) {
|
|
26
|
+
return {
|
|
27
|
+
type: error.name,
|
|
28
|
+
message: error.message
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
type: 'BaseError',
|
|
33
|
+
message: 'Call rejected'
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The entry point for KMC server side APIs. Provides the ability to register handlers
|
|
38
|
+
* and update media session states
|
|
39
|
+
*/
|
|
40
|
+
class MediaControlServer {
|
|
41
|
+
/**
|
|
42
|
+
* Get the major version number of the TM interface
|
|
43
|
+
* @returns @type {number} the major version
|
|
44
|
+
*/
|
|
45
|
+
static getMajorVersion() {
|
|
46
|
+
return KeplerMediaControlsServerTM_1.default.getMajorVersion();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get the minor version number of the TM interface
|
|
50
|
+
* @returns @type {number} the minor version
|
|
51
|
+
*/
|
|
52
|
+
static getMinorVersion() {
|
|
53
|
+
return KeplerMediaControlsServerTM_1.default.getMinorVersion();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get the patch version number of the TM interface
|
|
57
|
+
* @returns @type {number} the patch version
|
|
58
|
+
*/
|
|
59
|
+
static getPatchVersion() {
|
|
60
|
+
return KeplerMediaControlsServerTM_1.default.getPatchVersion();
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Set the event handlers associated with the provided component
|
|
64
|
+
* @param handler @type {KeplerMediaControlsTypes.IMediaControlHandlerAsync} Object containing
|
|
65
|
+
* the event handlers
|
|
66
|
+
* @param componentInstance @type {IComponentInstance} The component instance for which
|
|
67
|
+
* the handlers are being set
|
|
68
|
+
*/
|
|
69
|
+
setHandlerForComponent(handler, componentInstance) {
|
|
70
|
+
KeplerMediaControlsServerTM_1.default.setHandlerForComponent(componentInstance, (transactionId, sessionId) => {
|
|
71
|
+
handler.handlePlay(sessionId).then(() => {
|
|
72
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
73
|
+
}).catch((reason) => {
|
|
74
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
75
|
+
});
|
|
76
|
+
}, (transactionId, context, sessionId) => {
|
|
77
|
+
handler.handlePause(sessionId, context).then(() => {
|
|
78
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
79
|
+
}).catch((reason) => {
|
|
80
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
81
|
+
});
|
|
82
|
+
}, (transactionId, sessionId) => {
|
|
83
|
+
handler.handleTogglePlayPause(sessionId).then(() => {
|
|
84
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
85
|
+
}).catch((reason) => {
|
|
86
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
87
|
+
});
|
|
88
|
+
}, (transactionId, sessionId) => {
|
|
89
|
+
handler.handleStop(sessionId).then(() => {
|
|
90
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
91
|
+
}).catch((reason) => {
|
|
92
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
93
|
+
});
|
|
94
|
+
}, (transactionId, sessionId) => {
|
|
95
|
+
handler.handleStartOver(sessionId).then(() => {
|
|
96
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
97
|
+
}).catch((reason) => {
|
|
98
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
99
|
+
});
|
|
100
|
+
}, (transactionId, sessionId) => {
|
|
101
|
+
handler.handleFastForward(sessionId).then(() => {
|
|
102
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
103
|
+
}).catch((reason) => {
|
|
104
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
105
|
+
});
|
|
106
|
+
}, (transactionId, sessionId) => {
|
|
107
|
+
handler.handleRewind(sessionId).then(() => {
|
|
108
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
109
|
+
}).catch((reason) => {
|
|
110
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
111
|
+
});
|
|
112
|
+
}, (transactionId, speed, sessionId) => {
|
|
113
|
+
handler.handleSetPlaybackSpeed(speed, sessionId).then(() => {
|
|
114
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
115
|
+
}).catch((reason) => {
|
|
116
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
117
|
+
});
|
|
118
|
+
}, (transactionId, delta, sessionId) => {
|
|
119
|
+
handler.handleSkipForward(delta, sessionId).then(() => {
|
|
120
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
121
|
+
}).catch((reason) => {
|
|
122
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
123
|
+
});
|
|
124
|
+
}, (transactionId, delta, sessionId) => {
|
|
125
|
+
handler.handleSkipBackward(delta, sessionId).then(() => {
|
|
126
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
127
|
+
}).catch((reason) => {
|
|
128
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
129
|
+
});
|
|
130
|
+
}, (transactionId, position, sessionId) => {
|
|
131
|
+
handler.handleSeek(position, sessionId).then(() => {
|
|
132
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
133
|
+
}).catch((reason) => {
|
|
134
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
135
|
+
});
|
|
136
|
+
}, (transactionId, volume, sessionId) => {
|
|
137
|
+
handler.handleSetAudioVolume(volume, sessionId).then(() => {
|
|
138
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
139
|
+
}).catch((reason) => {
|
|
140
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
141
|
+
});
|
|
142
|
+
}, (transactionId, audioTrack, sessionId) => {
|
|
143
|
+
handler.handleSetAudioTrack(audioTrack, sessionId).then(() => {
|
|
144
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
145
|
+
}).catch((reason) => {
|
|
146
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
147
|
+
});
|
|
148
|
+
}, (transactionId, textTrack, sessionId) => {
|
|
149
|
+
handler.handleEnableTextTrack(textTrack, sessionId).then(() => {
|
|
150
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
151
|
+
}).catch((reason) => {
|
|
152
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
153
|
+
});
|
|
154
|
+
}, (transactionId, sessionId) => {
|
|
155
|
+
handler.handleDisableTextTrack(sessionId).then(() => {
|
|
156
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
157
|
+
}).catch((reason) => {
|
|
158
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
159
|
+
});
|
|
160
|
+
}, (transactionId, sessionId) => {
|
|
161
|
+
handler.handleNext(sessionId).then(() => {
|
|
162
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
163
|
+
}).catch((reason) => {
|
|
164
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
165
|
+
});
|
|
166
|
+
}, (transactionId, sessionId) => {
|
|
167
|
+
handler.handlePrevious(sessionId).then(() => {
|
|
168
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
169
|
+
}).catch((reason) => {
|
|
170
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
171
|
+
});
|
|
172
|
+
}, (transactionId, enable, sessionId) => {
|
|
173
|
+
handler.handleEnableShuffle(enable, sessionId).then(() => {
|
|
174
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
175
|
+
}).catch((reason) => {
|
|
176
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
177
|
+
});
|
|
178
|
+
}, (transactionId, mode, sessionId) => {
|
|
179
|
+
handler.handleSetRepeatMode(mode, sessionId).then(() => {
|
|
180
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
181
|
+
}).catch((reason) => {
|
|
182
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
183
|
+
});
|
|
184
|
+
}, (transactionId, id, rating, sessionId) => {
|
|
185
|
+
handler.handleSetRating(id, rating, sessionId).then(() => {
|
|
186
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
187
|
+
}).catch((reason) => {
|
|
188
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
189
|
+
});
|
|
190
|
+
}, (transactionId, id) => {
|
|
191
|
+
handler.handleGetMetadataInfo(id).then((metadata) => {
|
|
192
|
+
KeplerMediaControlsServerTM_1.default.getMetadataResponse(transactionId, metadata);
|
|
193
|
+
}).catch((reason) => {
|
|
194
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
195
|
+
});
|
|
196
|
+
}, (transactionId, action, sessionId) => {
|
|
197
|
+
handler.handleCustomAction(action, sessionId).then(() => {
|
|
198
|
+
KeplerMediaControlsServerTM_1.default.transactionSuccess(transactionId);
|
|
199
|
+
}).catch((reason) => {
|
|
200
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
201
|
+
});
|
|
202
|
+
}, (transactionId, sessionId) => {
|
|
203
|
+
handler.handleGetSessionState(sessionId).then((states) => {
|
|
204
|
+
KeplerMediaControlsServerTM_1.default.getSessionStateResponse(transactionId, states);
|
|
205
|
+
}).catch((reason) => {
|
|
206
|
+
KeplerMediaControlsServerTM_1.default.transactionError(transactionId, normalizeError(reason));
|
|
207
|
+
});
|
|
208
|
+
}).catch((error) => error);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Update the media session states
|
|
212
|
+
* @param states @type {KeplerMediaControlsTypes.MediaSessionState[]} Array of media session states
|
|
213
|
+
*/
|
|
214
|
+
updateMediaSessionStates(states) {
|
|
215
|
+
KeplerMediaControlsServerTM_1.default.updateMediaSessionStates(states);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
exports.MediaControlServer = MediaControlServer;
|
|
@@ -0,0 +1,29 @@
|
|
|
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.MediaControlServerComponentAsync = void 0;
|
|
17
|
+
const MediaControlServer_1 = require("./MediaControlServer");
|
|
18
|
+
let server;
|
|
19
|
+
exports.MediaControlServerComponentAsync = {
|
|
20
|
+
/**
|
|
21
|
+
* Makes or returns the MediaControlServer singleton
|
|
22
|
+
*/
|
|
23
|
+
getOrMakeServer() {
|
|
24
|
+
if (server === undefined || server === null) {
|
|
25
|
+
server = new MediaControlServer_1.MediaControlServer();
|
|
26
|
+
}
|
|
27
|
+
return server;
|
|
28
|
+
}
|
|
29
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.MediaControlServerComponentAsync = exports.MediaControlComponentAsync = void 0;
|
|
21
|
+
var MediaControlComponentAsync_1 = require("./MediaControlComponentAsync");
|
|
22
|
+
Object.defineProperty(exports, "MediaControlComponentAsync", { enumerable: true, get: function () { return __importDefault(MediaControlComponentAsync_1).default; } });
|
|
23
|
+
var MediaControlServerComponentAsync_1 = require("./MediaControlServerComponentAsync");
|
|
24
|
+
Object.defineProperty(exports, "MediaControlServerComponentAsync", { enumerable: true, get: function () { return MediaControlServerComponentAsync_1.MediaControlServerComponentAsync; } });
|
|
25
|
+
__exportStar(require("./turbo-modules/types"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"schema":1,"fileSets":{"native":[{"arch":"aarch64","variant":"release","directoryPath":"aarch64-release"},{"arch":"armv7","variant":"release","directoryPath":"armv7-release"},{"arch":"x86_64","variant":"release","directoryPath":"x86_64-release"},{"arch":"aarch64","variant":"debug","directoryPath":"aarch64-debug"},{"arch":"armv7","variant":"debug","directoryPath":"armv7-debug"},{"arch":"x86_64","variant":"debug","directoryPath":"x86_64-debug"}]}}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { KeplerTurboModule } from '@amazon-devices/keplerscript-turbomodule-api';
|
|
2
|
+
import * as KeplerMediaControlsTypes from './types';
|
|
3
|
+
import { IPackageId } from './types/KeplerMediaControlsTypes';
|
|
4
|
+
import { MediaId } from '@amazon-devices/kepler-media-types';
|
|
5
|
+
export interface Token {
|
|
6
|
+
readonly u: number;
|
|
7
|
+
readonly l: number;
|
|
8
|
+
}
|
|
9
|
+
export interface NativeClient {
|
|
10
|
+
readonly clientId: Token;
|
|
11
|
+
readonly packageName: string;
|
|
12
|
+
readonly componentName: string;
|
|
13
|
+
}
|
|
14
|
+
export interface KeplerMediaControlsClientTM extends KeplerTurboModule {
|
|
15
|
+
getMajorVersion: () => number;
|
|
16
|
+
getMinorVersion: () => number;
|
|
17
|
+
getPatchVersion: () => number;
|
|
18
|
+
getMediaControlEndpoints: () => Promise<NativeClient[]>;
|
|
19
|
+
addChangeListener: (onEndpointsChanged: (controllers: KeplerMediaControlsTypes.IMediaControlClientAsync[]) => void) => Promise<Token>;
|
|
20
|
+
removeChangeListener: (subscription: Token) => void;
|
|
21
|
+
play: (client: Token, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
22
|
+
pause: (client: Token, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
23
|
+
togglePlayPause: (client: Token, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
24
|
+
stop: (client: Token, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
25
|
+
startOver: (client: Token, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
26
|
+
fastForward: (client: Token, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
27
|
+
rewind: (client: Token, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
28
|
+
setPlaybackSpeed: (client: Token, speed: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
29
|
+
skipForward: (client: Token, delta: KeplerMediaControlsTypes.ITimeValue, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
30
|
+
skipBackward: (client: Token, delta: KeplerMediaControlsTypes.ITimeValue, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
31
|
+
seek: (client: Token, position: KeplerMediaControlsTypes.ITimeValue, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
32
|
+
setAudioVolume: (client: Token, volume: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
33
|
+
setAudioTrack: (client: Token, audioTrack: KeplerMediaControlsTypes.ITrack, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
34
|
+
enableTextTrack: (client: Token, textTrack?: KeplerMediaControlsTypes.ITrack, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
35
|
+
disableTextTrack: (client: Token, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
36
|
+
next: (client: Token, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
37
|
+
previous: (client: Token, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
38
|
+
enableShuffle: (client: Token, enable: boolean, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
39
|
+
setRepeatMode: (client: Token, mode: KeplerMediaControlsTypes.RepeatMode, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
40
|
+
setRating: (client: Token, id: MediaId, rating: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
41
|
+
getMetadata: (client: Token, id: MediaId) => Promise<KeplerMediaControlsTypes.IMediaMetadata>;
|
|
42
|
+
sendCustomAction: (client: Token, action: KeplerMediaControlsTypes.Action, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<void>;
|
|
43
|
+
getSessionState: (client: Token, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => Promise<KeplerMediaControlsTypes.MediaSessionState[]>;
|
|
44
|
+
addListener: (client: Token, onStateChanged: (updatedStates: KeplerMediaControlsTypes.MediaSessionState[]) => void) => Promise<Token>;
|
|
45
|
+
removeListener: (subscription: Token) => void;
|
|
46
|
+
getEndpointPackageId: (client: Token) => IPackageId;
|
|
47
|
+
destroy: (clientId: Token) => void;
|
|
48
|
+
}
|
|
49
|
+
declare const _default: KeplerMediaControlsClientTM;
|
|
50
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
const keplerscript_turbomodule_api_1 = require("@amazon-devices/keplerscript-turbomodule-api");
|
|
17
|
+
// prettier-ignore
|
|
18
|
+
exports.default = keplerscript_turbomodule_api_1.TurboModuleRegistry.getEnforcing('KeplerMediaControlsClientTM');
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { KeplerTurboModule } from '@amazon-devices/keplerscript-turbomodule-api';
|
|
2
|
+
import { IComponentInstance } from '@amazon-devices/react-native-kepler';
|
|
3
|
+
import * as KeplerMediaControlsTypes from './types';
|
|
4
|
+
import { MediaId } from '@amazon-devices/kepler-media-types';
|
|
5
|
+
export interface KeplerMediaControlsServerTM extends KeplerTurboModule {
|
|
6
|
+
getMajorVersion: () => number;
|
|
7
|
+
getMinorVersion: () => number;
|
|
8
|
+
getPatchVersion: () => number;
|
|
9
|
+
setHandlerForComponent: (componentInstance: IComponentInstance, playHandler: (transactionId: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, pauseHandler: (transactionId: number, context?: KeplerMediaControlsTypes.ICommandContext, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, togglePlayPauseHandler: (transactionId: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, stopHandler: (transactionId: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, startOverHandler: (transactionId: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, fastForwardHandler: (transactionId: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, rewindHandler: (transactionId: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, setPlaybackSpeedHandler: (transactionId: number, speed: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, skipForwardHandler: (transactionId: number, delta: KeplerMediaControlsTypes.ITimeValue, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, skipBackwardHandler: (transactionId: number, delta: KeplerMediaControlsTypes.ITimeValue, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, seekHandler: (transactionId: number, position: KeplerMediaControlsTypes.ITimeValue, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, setAudioVolumeHandler: (transactionId: number, volume: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, setAudioTrackHandler: (transactionId: number, audioTrack: KeplerMediaControlsTypes.ITrack, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, enableTextTrackHandler: (transactionId: number, textTrack: KeplerMediaControlsTypes.ITrack, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, disableTextTrackHandler: (transactionId: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, nextHandler: (transactionId: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, previousHandler: (transactionId: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, enableShuffleHandler: (transactionId: number, enable: boolean, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, setRepeatModeHandler: (transactionId: number, mode: KeplerMediaControlsTypes.RepeatMode, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, setRatingHandler: (transactionId: number, id: MediaId, rating: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, getMetadataInfoHandler: (transactionId: number, id: MediaId) => void, customActionHandler: (transactionId: number, action: KeplerMediaControlsTypes.Action, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void, getSessionStateHandler: (transactionId: number, sessionId?: KeplerMediaControlsTypes.IMediaSessionId) => void) => Promise<void>;
|
|
10
|
+
updateMediaSessionStates: (states: KeplerMediaControlsTypes.MediaSessionState[]) => void;
|
|
11
|
+
transactionSuccess: (transactionId: number) => void;
|
|
12
|
+
transactionError: (transactionId: number, error: KeplerMediaControlsTypes.KeplerMediaControlsError) => void;
|
|
13
|
+
getMetadataResponse: (transactionId: number, metadata: KeplerMediaControlsTypes.IMediaMetadata) => void;
|
|
14
|
+
getSessionStateResponse: (transactionId: number, states: KeplerMediaControlsTypes.MediaSessionState[]) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: KeplerMediaControlsServerTM;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
const keplerscript_turbomodule_api_1 = require("@amazon-devices/keplerscript-turbomodule-api");
|
|
17
|
+
// prettier-ignore
|
|
18
|
+
exports.default = keplerscript_turbomodule_api_1.TurboModuleRegistry.getEnforcing('KeplerMediaControlsServerTM');
|