@amazon-devices/kepler-player-server 2.2.3

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 (31) hide show
  1. package/LICENSE +7 -0
  2. package/SystemBundles/1ec2db48db4ef1b38507a6710528f56ecd29852766bb462b44556dd0c9057b71.bundle +1801 -0
  3. package/SystemBundles/1ec2db48db4ef1b38507a6710528f56ecd29852766bb462b44556dd0c9057b71.bundle.map +1 -0
  4. package/SystemModules/amzn__kepler-player-server-2.modules.txt +6 -0
  5. package/SystemModules/amzn__kepler-player-server-2.private.modules.txt +22 -0
  6. package/SystemModules/keplerscript-system-bundle-config.json +7 -0
  7. package/dist/index.d.ts +7 -0
  8. package/dist/index.js +3 -0
  9. package/dist/kepler/tm-manifest.json +1 -0
  10. package/dist/turbo-modules/IPlayerServer.d.ts +393 -0
  11. package/dist/turbo-modules/IPlayerServer.js +14 -0
  12. package/dist/turbo-modules/KeplerPlayerServerTurboModule.d.ts +18 -0
  13. package/dist/turbo-modules/KeplerPlayerServerTurboModule.js +3 -0
  14. package/dist/turbo-modules/PlayerServer.d.ts +42 -0
  15. package/dist/turbo-modules/PlayerServer.js +642 -0
  16. package/dist/turbo-modules/PlayerServerDataTypes/PlayerServerDataTypes.d.ts +319 -0
  17. package/dist/turbo-modules/PlayerServerDataTypes/PlayerServerDataTypes.js +67 -0
  18. package/dist/turbo-modules/PlayerServerDataTypes/PlayerServerDataTypesInternal.d.ts +17 -0
  19. package/dist/turbo-modules/PlayerServerDataTypes/PlayerServerDataTypesInternal.js +14 -0
  20. package/dist/turbo-modules/PlayerServerDataTypes/PlayerSessionError.d.ts +22 -0
  21. package/dist/turbo-modules/PlayerServerDataTypes/PlayerSessionError.js +37 -0
  22. package/dist/turbo-modules/PlayerServerFactory.d.ts +38 -0
  23. package/dist/turbo-modules/PlayerServerFactory.js +28 -0
  24. package/dist/turbo-modules/PlayerServerHandler.d.ts +374 -0
  25. package/dist/turbo-modules/PlayerServerHandler.js +1 -0
  26. package/dist/turbo-modules/__mocks__/KeplerPlayerServerTurboModule.d.ts +22 -0
  27. package/dist/turbo-modules/__mocks__/KeplerPlayerServerTurboModule.js +32 -0
  28. package/kepler-compatibility.json +14 -0
  29. package/kepler-transformed-package-info.json +3 -0
  30. package/package.json +1 -0
  31. package/react-native.config.js +17 -0
@@ -0,0 +1,319 @@
1
+ /**
2
+ * Defines a HTTP header. Apps can send the headers required for
3
+ * authenticating and fetching the URL as name-value pair.
4
+ *
5
+ * Apps can also use it to send other metadata associated with
6
+ * the media content as well.
7
+ */
8
+ export interface IHttpHeader {
9
+ /**
10
+ * The name of the HTTP header.
11
+ */
12
+ name: string;
13
+ /**
14
+ * The value of the HTTP header.
15
+ */
16
+ value: string;
17
+ }
18
+ /**
19
+ * Defines a time range for buffered content in media playback.
20
+ *
21
+ * The service component creates an array of these ranges and sends them to
22
+ * the interactive component via `IPlayerServer.updateBufferedRanges`.
23
+ */
24
+ export interface ITimeRange {
25
+ /**
26
+ * Start position (in seconds)
27
+ */
28
+ start: number;
29
+ /**
30
+ * End position (in seconds)
31
+ */
32
+ end: number;
33
+ }
34
+ /**
35
+ * Defines a media URL with optional HTTP headers.
36
+ */
37
+ export interface IMediaLocator {
38
+ /**
39
+ * Media URL
40
+ */
41
+ url: string;
42
+ /**
43
+ * Optional. HTTP headers (authentication and extra data) for fetching media URL.
44
+ */
45
+ httpHeaders?: Array<IHttpHeader>;
46
+ }
47
+ /**
48
+ * Defines the type of text track and how it should be handled.
49
+ *
50
+ * Possible values:
51
+ * - "subtitles": Translation of dialog for non-native language speakers
52
+ * - "captions": Transcription of dialog and sound effects for accessibility
53
+ * - "metadata": Track used for scripting purposes
54
+ *
55
+ * @see https://html.spec.whatwg.org/multipage/media.html#text-track-kind
56
+ */
57
+ export declare type ITextTrackKind = "subtitles" | "captions" | "metadata";
58
+ /**
59
+ * Defines out-of-band (OOB) text track information.
60
+ */
61
+ export interface IOobTextTrackInfo {
62
+ /**
63
+ * URL and headers for fetching text track data
64
+ */
65
+ textUrl: IMediaLocator;
66
+ /**
67
+ * Track type (subtitles/captions/metadata)
68
+ */
69
+ kind: ITextTrackKind;
70
+ /**
71
+ * Display name of the text track
72
+ */
73
+ label: string;
74
+ /**
75
+ * Language code of the text track
76
+ *
77
+ * @see https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-language
78
+ */
79
+ language: string;
80
+ /**
81
+ * MIME type of the text track content
82
+ */
83
+ mimeType: string;
84
+ }
85
+ /**
86
+ * Represents URLs and HTTP headers required for fetching media content.
87
+ */
88
+ export interface IPlayerSessionMediaInfo {
89
+ /**
90
+ * The URL needed to fetch the media content.
91
+ */
92
+ mediaUrl: IMediaLocator;
93
+ /**
94
+ * Optional. The Licence Acquisition (LA) URL needed to fetch the DRM license.
95
+ */
96
+ laUrl?: IMediaLocator;
97
+ /**
98
+ * Optional. The Out-of-band (OOB) metadata required to fetch the subtitles.
99
+ */
100
+ oobTextTrackInfo?: Array<IOobTextTrackInfo>;
101
+ }
102
+ /**
103
+ * An interface describes surface handle returned by KeplerVideoSurfaceView or KeplerCaptionsView.
104
+ */
105
+ export interface IViewHandle {
106
+ /**
107
+ * String handle for KeplerVideoSurfaceView or KeplerCaptionsView.
108
+ */
109
+ handle: string;
110
+ }
111
+ /**
112
+ * Describes media playback position and timing information
113
+ */
114
+ export interface IPlayerSessionPosition {
115
+ /**
116
+ * Optional. Identifier for the media session
117
+ */
118
+ sessionId?: IPlayerSessionId;
119
+ /**
120
+ * Current playback position at the time of `updatedAtTime`
121
+ * in seconds.
122
+ */
123
+ position: number;
124
+ }
125
+ /**
126
+ * An interface describes media session ID.
127
+ * `IPlayerSessionId` is useful in case there are multiple media playbacks and clients want to call the
128
+ * IPlayerClient or IPlayerServer APIs for specific media playback.
129
+ */
130
+ export interface IPlayerSessionId {
131
+ /**
132
+ * Identifier for player session represented by a positive number.
133
+ */
134
+ id: number;
135
+ }
136
+ /**
137
+ * Represents the possible states of media playback.
138
+ * This must be set in `IPlayerSessionStatus` depending on the events received
139
+ * after registering event listeners.
140
+ *
141
+ * @see https://html.spec.whatwg.org/#event-handlers-on-elements,-document-objects,-and-window-objects
142
+ */
143
+ export declare enum IPlayerSessionState {
144
+ /**
145
+ * Playback is temporarily stopped
146
+ */
147
+ PAUSED = "PAUSED",
148
+ /**
149
+ * Media content is actively playing
150
+ */
151
+ PLAYING = "PLAYING",
152
+ /**
153
+ * Media is loading into temporary storage
154
+ */
155
+ BUFFERING = "BUFFERING",
156
+ /**
157
+ * Playback position is being changed
158
+ */
159
+ SEEKING = "SEEKING",
160
+ /**
161
+ * Media playback has reached its conclusion
162
+ */
163
+ ENDED = "ENDED",
164
+ /**
165
+ * Playback has encountered an error
166
+ */
167
+ ERROR = "ERROR"
168
+ }
169
+ /**
170
+ * Represents the possible status values of synchronous unload of media playback.
171
+ * Associated with {@link @amazon-devices/kepler-player-client#IPlayerClient.unloadSync} API.
172
+ * These values are in sync with {@link @amazon-devices/react-native-w3cmedia#MediaPlayerDeInitStatus|W3CMedia MediaPlayerDeInitStatus}
173
+ */
174
+ export declare enum IUnloadSyncStatus {
175
+ /**
176
+ * Media playback instance was unloaded successfully.
177
+ */
178
+ SUCCESS = "success",
179
+ /**
180
+ * Media playback instance unload timed out.
181
+ */
182
+ TIMEDOUT = "timedout",
183
+ /**
184
+ * Invalid request for media playback unload.
185
+ */
186
+ INVALID = "invalid"
187
+ }
188
+ /**
189
+ * Represents a subscription that can be used to subscribe to various things.
190
+ * like media playback position listener, media state changes etc.
191
+ */
192
+ export interface ISubscription {
193
+ /**
194
+ * Removes the subscription. Used to de-register the listener.
195
+ * Call this before destroying the client component.
196
+ */
197
+ unsubscribe: () => void;
198
+ }
199
+ /**
200
+ * Represents the current status of media playback.
201
+ * Apps can use this status to update their UI components.
202
+ */
203
+ export interface IPlayerSessionStatus {
204
+ /**
205
+ * Optional. Identifier for the player session
206
+ */
207
+ readonly sessionId?: IPlayerSessionId;
208
+ /**
209
+ * Current playback speed (e.g., 0.5, 1.0, 2.0)
210
+ */
211
+ readonly playbackRate: number;
212
+ /**
213
+ * Current state of media playback
214
+ */
215
+ readonly playbackState: IPlayerSessionState;
216
+ /**
217
+ * Indicates if audio is muted
218
+ */
219
+ readonly isMuted: boolean;
220
+ /**
221
+ * Current volume level (range: 0.0 to 1.0)
222
+ */
223
+ readonly volume: number;
224
+ /**
225
+ * Indicates if seeking is allowed
226
+ */
227
+ readonly seekable: boolean;
228
+ /**
229
+ * Optional. Total duration of the media content
230
+ */
231
+ readonly duration?: number;
232
+ }
233
+ /**
234
+ * Defines parameters for loading media content by URL
235
+ */
236
+ export interface IPlayerSessionLoadParams {
237
+ /**
238
+ * Initial playback position (in seconds)
239
+ *
240
+ * Specified relative to the start of the media, where 0 represents the beginning
241
+ */
242
+ startPosition: number;
243
+ /**
244
+ * Indicates whether playback should start automatically after content is loaded
245
+ */
246
+ autoPlay: boolean;
247
+ }
248
+ /**
249
+ * Defines the available types of media tracks:
250
+ *
251
+ * - AUDIO: Audio track containing sound content
252
+ * - VIDEO: Video track containing visual content
253
+ * - TEXT: Text track containing subtitles, captions, or metadata
254
+ */
255
+ export declare type ITrackType = "AUDIO" | "VIDEO" | "TEXT";
256
+ /**
257
+ * Represents the display mode of the text track.
258
+ *
259
+ * For additional information, see
260
+ * https://html.spec.whatwg.org/multipage/media.html#texttrackmode.
261
+ */
262
+ export declare type ITextTrackMode = "disabled" | "hidden" | "showing";
263
+ /**
264
+ * Represents detailed information about a media track
265
+ */
266
+ export interface ITrackInfo {
267
+ /**
268
+ * Unique identifier of the track
269
+ */
270
+ readonly id: string;
271
+ /**
272
+ * Type of the track (AUDIO, VIDEO, or TEXT)
273
+ */
274
+ readonly type: ITrackType;
275
+ /**
276
+ * Specific classification of the track (e.g., "main", "commentary", "subtitles")
277
+ */
278
+ readonly kind: string;
279
+ /**
280
+ * User-friendly label for the track
281
+ */
282
+ readonly label: string;
283
+ /**
284
+ * Language of the track content (e.g., "en", "es")
285
+ *
286
+ * For "AUDIO" ITrackType, refer to: https://html.spec.whatwg.org/multipage/media.html#dom-audiotrack-language
287
+ * For "TEXT" ITrackType, refer to: https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-language
288
+ */
289
+ readonly language: string;
290
+ /**
291
+ * Indicates if the track is currently active
292
+ * Applicable only for AUDIO or VIDEO tracks
293
+ */
294
+ readonly enabled?: boolean;
295
+ /**
296
+ * Display mode of the text track
297
+ * Applicable only for TEXT tracks
298
+ */
299
+ readonly mode?: ITextTrackMode;
300
+ }
301
+ /**
302
+ * Represents an error in the Kepler player session.
303
+ */
304
+ export interface IPlayerSessionError {
305
+ /**
306
+ * Returns the current error's error code, from the list below.
307
+ *
308
+ * For additional information, see
309
+ * https://html.spec.whatwg.org/multipage/media.html#concept-mediaerror-code.
310
+ */
311
+ readonly code: number;
312
+ /**
313
+ * Returns a specific informative diagnostic message about the error condition encountered.
314
+ *
315
+ * For additional information, see
316
+ * https://html.spec.whatwg.org/multipage/media.html#dom-mediaerror-message.
317
+ */
318
+ readonly message: string;
319
+ }
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Copyright 2025 Amazon.com, Inc. or its affiliates. All rights reserved.
3
+ *
4
+ * AMAZON PROPRIETARY/CONFIDENTIAL
5
+ *
6
+ * You may not use this file except in compliance with the terms and
7
+ * conditions set forth in the accompanying LICENSE.TXT file.
8
+ *
9
+ * THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
10
+ * DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
11
+ * IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
12
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
13
+ */
14
+ /**
15
+ * Represents the possible states of media playback.
16
+ * This must be set in `IPlayerSessionStatus` depending on the events received
17
+ * after registering event listeners.
18
+ *
19
+ * @see https://html.spec.whatwg.org/#event-handlers-on-elements,-document-objects,-and-window-objects
20
+ */
21
+ export var IPlayerSessionState;
22
+ (function (IPlayerSessionState) {
23
+ /**
24
+ * Playback is temporarily stopped
25
+ */
26
+ IPlayerSessionState["PAUSED"] = "PAUSED";
27
+ /**
28
+ * Media content is actively playing
29
+ */
30
+ IPlayerSessionState["PLAYING"] = "PLAYING";
31
+ /**
32
+ * Media is loading into temporary storage
33
+ */
34
+ IPlayerSessionState["BUFFERING"] = "BUFFERING";
35
+ /**
36
+ * Playback position is being changed
37
+ */
38
+ IPlayerSessionState["SEEKING"] = "SEEKING";
39
+ /**
40
+ * Media playback has reached its conclusion
41
+ */
42
+ IPlayerSessionState["ENDED"] = "ENDED";
43
+ /**
44
+ * Playback has encountered an error
45
+ */
46
+ IPlayerSessionState["ERROR"] = "ERROR";
47
+ })(IPlayerSessionState || (IPlayerSessionState = {}));
48
+ /**
49
+ * Represents the possible status values of synchronous unload of media playback.
50
+ * Associated with {@link @amazon-devices/kepler-player-client#IPlayerClient.unloadSync} API.
51
+ * These values are in sync with {@link @amazon-devices/react-native-w3cmedia#MediaPlayerDeInitStatus|W3CMedia MediaPlayerDeInitStatus}
52
+ */
53
+ export var IUnloadSyncStatus;
54
+ (function (IUnloadSyncStatus) {
55
+ /**
56
+ * Media playback instance was unloaded successfully.
57
+ */
58
+ IUnloadSyncStatus["SUCCESS"] = "success";
59
+ /**
60
+ * Media playback instance unload timed out.
61
+ */
62
+ IUnloadSyncStatus["TIMEDOUT"] = "timedout";
63
+ /**
64
+ * Invalid request for media playback unload.
65
+ */
66
+ IUnloadSyncStatus["INVALID"] = "invalid";
67
+ })(IUnloadSyncStatus || (IUnloadSyncStatus = {}));
@@ -0,0 +1,17 @@
1
+ import { IPlayerSessionId, IPlayerSessionLoadParams, IPlayerSessionMediaInfo, ITrackType, IViewHandle } from './PlayerServerDataTypes';
2
+ /**
3
+ * Internal use-only interface for IPlayerServerHandler.
4
+ */
5
+ export interface PlayerEventHandlerParams {
6
+ event: string;
7
+ urlInfo?: IPlayerSessionMediaInfo;
8
+ loadParams?: IPlayerSessionLoadParams;
9
+ sessionId?: IPlayerSessionId;
10
+ handle?: IViewHandle;
11
+ timevalue?: number;
12
+ boolValue?: boolean;
13
+ numberValue?: number;
14
+ stringValue?: string;
15
+ trackType?: ITrackType;
16
+ customData?: string;
17
+ }
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright 2025 Amazon.com, Inc. or its affiliates. All rights reserved.
3
+ *
4
+ * AMAZON PROPRIETARY/CONFIDENTIAL
5
+ *
6
+ * You may not use this file except in compliance with the terms and
7
+ * conditions set forth in the accompanying LICENSE.TXT file.
8
+ *
9
+ * THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
10
+ * DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
11
+ * IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
12
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
13
+ */
14
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * All media elements have an associated error status,
3
+ * which records the last error the element encountered since its resource
4
+ * selection algorithm was last invoked.
5
+ * Onre getting an error while perforning handle functions,
6
+ * apps must create instance of `PlayerSessionError`
7
+ * to reject the promise in corresponding `PlayerServerHandler` handle functions.
8
+ *
9
+ * For additional information, see
10
+ * https://html.spec.whatwg.org/multipage/media.html#mediaerror.
11
+ */
12
+ export declare class PlayerSessionError extends Error {
13
+ /**
14
+ * Initializes a new instance of `PlayerSessionError`.
15
+ */
16
+ constructor(message: any);
17
+ }
18
+ /**
19
+ * Error occurs when the given argument is invalid.
20
+ */
21
+ export declare class InvalidArgumentError extends PlayerSessionError {
22
+ }
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Copyright 2025 Amazon.com, Inc. or its affiliates. All rights reserved.
3
+ *
4
+ * AMAZON PROPRIETARY/CONFIDENTIAL
5
+ *
6
+ * You may not use this file except in compliance with the terms and
7
+ * conditions set forth in the accompanying LICENSE.TXT file.
8
+ *
9
+ * THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
10
+ * DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
11
+ * IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
12
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
13
+ */
14
+ /**
15
+ * All media elements have an associated error status,
16
+ * which records the last error the element encountered since its resource
17
+ * selection algorithm was last invoked.
18
+ * Onre getting an error while perforning handle functions,
19
+ * apps must create instance of `PlayerSessionError`
20
+ * to reject the promise in corresponding `PlayerServerHandler` handle functions.
21
+ *
22
+ * For additional information, see
23
+ * https://html.spec.whatwg.org/multipage/media.html#mediaerror.
24
+ */
25
+ export class PlayerSessionError extends Error {
26
+ /**
27
+ * Initializes a new instance of `PlayerSessionError`.
28
+ */
29
+ constructor(message) {
30
+ super(message);
31
+ }
32
+ }
33
+ /**
34
+ * Error occurs when the given argument is invalid.
35
+ */
36
+ export class InvalidArgumentError extends PlayerSessionError {
37
+ }
@@ -0,0 +1,38 @@
1
+ import { IPlayerServer } from './IPlayerServer';
2
+ /**
3
+ * Component that provides a kepler player server instance.
4
+ */
5
+ export interface IPlayerServerFactory {
6
+ /**
7
+ * Get or make an instance of kepler player server.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * // Sample usage
12
+ * import {
13
+ * PlayerServerFactory,
14
+ * IPlayerServer
15
+ * } from '@amazon-devices/kepler-player-server';
16
+ *
17
+ * const playerServerRef = useRef<IPlayerClient | null>(null);
18
+ * const playerServerFactory = new PlayerServerFactory();
19
+ *
20
+ * if (playerServerRef.current == null) {
21
+ * playerServerRef.current = playerServerFactory.getOrMakeServer();
22
+ * }
23
+ * ```
24
+ *
25
+ * @returns {IPlayerServer} A kepler player server instance.
26
+ */
27
+ getOrMakeServer(): IPlayerServer;
28
+ }
29
+ /** @ignore */
30
+ export declare class PlayerServerFactory {
31
+ private static server;
32
+ /**
33
+ * Makes or returns the PlayerServer singleton
34
+ */
35
+ getOrMakeServer(): IPlayerServer;
36
+ }
37
+ declare const _default: PlayerServerFactory;
38
+ export default _default;
@@ -0,0 +1,28 @@
1
+ /*
2
+ * Copyright 2025 Amazon.com, Inc. or its affiliates. All rights reserved.
3
+ *
4
+ * AMAZON PROPRIETARY/CONFIDENTIAL
5
+ *
6
+ * You may not use this file except in compliance with the terms and
7
+ * conditions set forth in the accompanying LICENSE.TXT file.
8
+ *
9
+ * THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
10
+ * DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
11
+ * IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
12
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
13
+ */
14
+ import { PlayerServer } from './PlayerServer';
15
+ /** @ignore */
16
+ export class PlayerServerFactory {
17
+ static server;
18
+ /**
19
+ * Makes or returns the PlayerServer singleton
20
+ */
21
+ getOrMakeServer() {
22
+ if (!PlayerServerFactory.server) {
23
+ PlayerServerFactory.server = new PlayerServer();
24
+ }
25
+ return PlayerServerFactory.server;
26
+ }
27
+ }
28
+ export default new PlayerServerFactory();