@mentra/sdk 2.1.1 โ 2.1.2
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/dist/app/session/events.d.ts +2 -1
- package/dist/app/session/events.d.ts.map +1 -1
- package/dist/app/session/index.d.ts +14 -5
- package/dist/app/session/index.d.ts.map +1 -1
- package/dist/app/session/index.js +71 -21
- package/dist/app/session/modules/audio.d.ts +190 -0
- package/dist/app/session/modules/audio.d.ts.map +1 -0
- package/dist/app/session/modules/audio.js +317 -0
- package/dist/app/session/modules/camera-managed-extension.d.ts +152 -0
- package/dist/app/session/modules/camera-managed-extension.d.ts.map +1 -0
- package/dist/app/session/modules/camera-managed-extension.js +231 -0
- package/dist/app/session/modules/camera.d.ts +55 -1
- package/dist/app/session/modules/camera.d.ts.map +1 -1
- package/dist/app/session/modules/camera.js +72 -0
- package/dist/app/session/modules/index.d.ts +4 -0
- package/dist/app/session/modules/index.d.ts.map +1 -0
- package/dist/app/session/modules/index.js +19 -0
- package/dist/app/session/modules/location.d.ts +16 -0
- package/dist/app/session/modules/location.d.ts.map +1 -0
- package/dist/app/session/modules/location.js +55 -0
- package/dist/app/webview/index.d.ts.map +1 -1
- package/dist/app/webview/index.js +0 -1
- package/dist/examples/managed-rtmp-streaming-example.d.ts +2 -0
- package/dist/examples/managed-rtmp-streaming-example.d.ts.map +1 -0
- package/dist/examples/managed-rtmp-streaming-example.js +155 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/types/enums.d.ts +3 -1
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/enums.js +2 -0
- package/dist/types/index.d.ts +5 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +7 -1
- package/dist/types/message-types.d.ts +14 -2
- package/dist/types/message-types.d.ts.map +1 -1
- package/dist/types/message-types.js +16 -0
- package/dist/types/messages/app-to-cloud.d.ts +65 -3
- package/dist/types/messages/app-to-cloud.d.ts.map +1 -1
- package/dist/types/messages/app-to-cloud.js +28 -0
- package/dist/types/messages/cloud-to-app.d.ts +26 -1
- package/dist/types/messages/cloud-to-app.d.ts.map +1 -1
- package/dist/types/messages/cloud-to-app.js +8 -0
- package/dist/types/messages/cloud-to-glasses.d.ts +38 -1
- package/dist/types/messages/cloud-to-glasses.d.ts.map +1 -1
- package/dist/types/messages/cloud-to-glasses.js +8 -0
- package/dist/types/messages/glasses-to-cloud.d.ts +14 -1
- package/dist/types/messages/glasses-to-cloud.d.ts.map +1 -1
- package/dist/types/messages/glasses-to-cloud.js +4 -0
- package/dist/types/models.d.ts +13 -0
- package/dist/types/models.d.ts.map +1 -1
- package/dist/types/models.js +9 -0
- package/dist/types/streams.d.ts +6 -0
- package/dist/types/streams.d.ts.map +1 -1
- package/dist/types/streams.js +4 -0
- package/package.json +1 -1
@@ -2,7 +2,7 @@
|
|
2
2
|
* ๐ฎ Event Manager Module
|
3
3
|
*/
|
4
4
|
import EventEmitter from 'events';
|
5
|
-
import { StreamType, ExtendedStreamType, AppSettings, WebSocketError, ButtonPress, HeadPosition, PhoneNotification, TranscriptionData, TranslationData, GlassesBatteryUpdate, PhoneBatteryUpdate, GlassesConnectionState, LocationUpdate, Vad, NotificationDismissed, AudioChunk, CalendarEvent, VpsCoordinates, CustomMessage, RtmpStreamStatus, PhotoTaken } from '../../types';
|
5
|
+
import { StreamType, ExtendedStreamType, AppSettings, WebSocketError, ButtonPress, HeadPosition, PhoneNotification, TranscriptionData, TranslationData, GlassesBatteryUpdate, PhoneBatteryUpdate, GlassesConnectionState, LocationUpdate, Vad, NotificationDismissed, AudioChunk, CalendarEvent, VpsCoordinates, CustomMessage, RtmpStreamStatus, PhotoTaken, ManagedStreamStatus } from '../../types';
|
6
6
|
import { DashboardMode } from '../../types/dashboard';
|
7
7
|
import { PermissionErrorDetail } from '../../types/messages/cloud-to-app';
|
8
8
|
/** ๐ฏ Type-safe event handler function */
|
@@ -56,6 +56,7 @@ export interface StreamDataTypes {
|
|
56
56
|
[StreamType.AUDIO_CHUNK]: AudioChunk;
|
57
57
|
[StreamType.VIDEO]: ArrayBuffer;
|
58
58
|
[StreamType.RTMP_STREAM_STATUS]: RtmpStreamStatus;
|
59
|
+
[StreamType.MANAGED_STREAM_STATUS]: ManagedStreamStatus;
|
59
60
|
[StreamType.VPS_COORDINATES]: VpsCoordinates;
|
60
61
|
[StreamType.PHOTO_TAKEN]: PhotoTaken;
|
61
62
|
[StreamType.OPEN_DASHBOARD]: never;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/app/session/events.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,cAAc,EAEd,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,EACd,GAAG,EACH,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,cAAc,EAKd,aAAa,EACb,gBAAgB,EAChB,UAAU,
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/app/session/events.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,cAAc,EAEd,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,EACd,GAAG,EACH,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,cAAc,EAKd,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD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B,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAIrF;;OAEG;IACH,OAAO,CAAC,UAAU;IAclB;;OAEG;IACH,OAAO,CAAC,aAAa;IAcrB;;OAEG;IACH,IAAI,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI;IA2D7D;;;;;OAKG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,IAAI;IAW5E,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,SA3GxC,IAAI;IA+Gb;;;;OAIG;IACH,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,SApHhC,IAAI;CAuHd"}
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import { EventManager, EventData } from './events';
|
2
2
|
import { LayoutManager } from './layouts';
|
3
3
|
import { SettingsManager } from './settings';
|
4
|
+
import { LocationManager } from './modules/location';
|
4
5
|
import { CameraModule } from './modules/camera';
|
5
|
-
import {
|
6
|
+
import { AudioManager } from './modules/audio';
|
7
|
+
import { ExtendedStreamType, ButtonPress, HeadPosition, PhoneNotification, TranscriptionData, TranslationData, AppSettings, AppSetting, AppConfig, VpsCoordinates, PhotoTaken, SubscriptionRequest, Capabilities } from '../../types';
|
6
8
|
import { DashboardAPI } from '../../types/dashboard';
|
7
9
|
import { Logger } from 'pino';
|
8
10
|
import { AppServer } from '../server';
|
@@ -71,6 +73,8 @@ export declare class AppSession {
|
|
71
73
|
private reconnectAttempts;
|
72
74
|
/** Active event subscriptions */
|
73
75
|
private subscriptions;
|
76
|
+
/** Map to store rate options for streams */
|
77
|
+
private streamRates;
|
74
78
|
/** Resource tracker for automatic cleanup */
|
75
79
|
private resources;
|
76
80
|
/** Internal settings storage - use public settings API instead */
|
@@ -95,8 +99,12 @@ export declare class AppSession {
|
|
95
99
|
readonly settings: SettingsManager;
|
96
100
|
/** ๐ Dashboard management interface */
|
97
101
|
readonly dashboard: DashboardAPI;
|
102
|
+
/** ๐ Location management interface */
|
103
|
+
readonly location: LocationManager;
|
98
104
|
/** ๐ท Camera interface for photos and streaming */
|
99
105
|
readonly camera: CameraModule;
|
106
|
+
/** ๐ Audio interface for audio playback */
|
107
|
+
readonly audio: AudioManager;
|
100
108
|
readonly appServer: AppServer;
|
101
109
|
readonly logger: Logger;
|
102
110
|
readonly userId: string;
|
@@ -175,14 +183,14 @@ export declare class AppSession {
|
|
175
183
|
onPhotoTaken(handler: (data: PhotoTaken) => void): () => void;
|
176
184
|
/**
|
177
185
|
* ๐ฌ Subscribe to a specific event stream
|
178
|
-
* @param
|
186
|
+
* @param sub - A string or a rich subscription object
|
179
187
|
*/
|
180
|
-
subscribe(
|
188
|
+
subscribe(sub: SubscriptionRequest): void;
|
181
189
|
/**
|
182
190
|
* ๐ญ Unsubscribe from a specific event stream
|
183
|
-
* @param
|
191
|
+
* @param sub - The subscription to remove
|
184
192
|
*/
|
185
|
-
unsubscribe(
|
193
|
+
unsubscribe(sub: SubscriptionRequest): void;
|
186
194
|
/**
|
187
195
|
* ๐ฏ Generic event listener (pub/sub style)
|
188
196
|
* @param event - Event name to listen for
|
@@ -416,4 +424,5 @@ export declare class TpaSession extends AppSession {
|
|
416
424
|
constructor(config: TpaSessionConfig);
|
417
425
|
}
|
418
426
|
export { CameraModule, PhotoRequestOptions, RtmpStreamOptions } from './modules/camera';
|
427
|
+
export { AudioManager, AudioPlayOptions, AudioPlayResult, SpeakOptions } from './modules/audio';
|
419
428
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/session/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,SAAS,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O,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,IAAI;IAKzD;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,IAAI;IAKvD;;;;OAIG;IACH,gBAAgB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,IAAI;IAK1D;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CAG1B;AAGD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,qBAAa,UAAW,SAAQ,UAAU;gBAC5B,MAAM,EAAE,gBAAgB;CASrC;AAGD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.CameraModule = exports.TpaSession = exports.AppSession = void 0;
|
6
|
+
exports.AudioManager = exports.CameraModule = exports.TpaSession = exports.AppSession = void 0;
|
7
7
|
/**
|
8
8
|
* ๐ฏ App Session Module
|
9
9
|
*
|
@@ -14,11 +14,14 @@ const ws_1 = require("ws");
|
|
14
14
|
const events_1 = require("./events");
|
15
15
|
const layouts_1 = require("./layouts");
|
16
16
|
const settings_1 = require("./settings");
|
17
|
+
const location_1 = require("./modules/location");
|
17
18
|
const camera_1 = require("./modules/camera");
|
19
|
+
const audio_1 = require("./modules/audio");
|
18
20
|
const resource_tracker_1 = require("../../utils/resource-tracker");
|
19
21
|
const types_1 = require("../../types");
|
20
22
|
const axios_1 = __importDefault(require("axios"));
|
21
23
|
const events_2 = __importDefault(require("events"));
|
24
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
22
25
|
// Import the cloud-to-app specific type guards
|
23
26
|
const cloud_to_app_1 = require("../../types/messages/cloud-to-app");
|
24
27
|
// List of event types that should never be subscribed to as streams
|
@@ -66,6 +69,8 @@ class AppSession {
|
|
66
69
|
this.reconnectAttempts = 0;
|
67
70
|
/** Active event subscriptions */
|
68
71
|
this.subscriptions = new Set();
|
72
|
+
/** Map to store rate options for streams */
|
73
|
+
this.streamRates = new Map();
|
69
74
|
/** Resource tracker for automatic cleanup */
|
70
75
|
this.resources = new resource_tracker_1.ResourceTracker();
|
71
76
|
/** Internal settings storage - use public settings API instead */
|
@@ -156,6 +161,10 @@ class AppSession {
|
|
156
161
|
// Initialize camera module with session reference
|
157
162
|
this.camera = new camera_1.CameraModule(this.config.packageName, this.sessionId || 'unknown-session-id', this.send.bind(this), this, // Pass session reference
|
158
163
|
this.logger.child({ module: 'camera' }));
|
164
|
+
// Initialize audio module with session reference
|
165
|
+
this.audio = new audio_1.AudioManager(this.config.packageName, this.sessionId || 'unknown-session-id', this.send.bind(this), this, // Pass session reference
|
166
|
+
this.logger.child({ module: 'audio' }));
|
167
|
+
this.location = new location_1.LocationManager(this, this.send.bind(this));
|
159
168
|
}
|
160
169
|
/**
|
161
170
|
* Get the current session ID
|
@@ -255,28 +264,49 @@ class AppSession {
|
|
255
264
|
// =====================================
|
256
265
|
/**
|
257
266
|
* ๐ฌ Subscribe to a specific event stream
|
258
|
-
* @param
|
267
|
+
* @param sub - A string or a rich subscription object
|
259
268
|
*/
|
260
|
-
subscribe(
|
269
|
+
subscribe(sub) {
|
270
|
+
let type;
|
271
|
+
let rate;
|
272
|
+
if (typeof sub === 'string') {
|
273
|
+
type = sub;
|
274
|
+
}
|
275
|
+
else {
|
276
|
+
// it's a LocationStreamRequest object
|
277
|
+
type = sub.stream;
|
278
|
+
rate = sub.rate;
|
279
|
+
}
|
261
280
|
if (APP_TO_APP_EVENT_TYPES.includes(type)) {
|
262
281
|
this.logger.warn(`[AppSession] Attempted to subscribe to App-to-App event type '${type}', which is not a valid stream. Use the event handler (e.g., onAppMessage) instead.`);
|
263
282
|
return;
|
264
283
|
}
|
265
284
|
this.subscriptions.add(type);
|
285
|
+
if (rate) {
|
286
|
+
this.streamRates.set(type, rate);
|
287
|
+
}
|
266
288
|
if (this.ws?.readyState === 1) {
|
267
289
|
this.updateSubscriptions();
|
268
290
|
}
|
269
291
|
}
|
270
292
|
/**
|
271
293
|
* ๐ญ Unsubscribe from a specific event stream
|
272
|
-
* @param
|
294
|
+
* @param sub - The subscription to remove
|
273
295
|
*/
|
274
|
-
unsubscribe(
|
296
|
+
unsubscribe(sub) {
|
297
|
+
let type;
|
298
|
+
if (typeof sub === 'string') {
|
299
|
+
type = sub;
|
300
|
+
}
|
301
|
+
else {
|
302
|
+
type = sub.stream;
|
303
|
+
}
|
275
304
|
if (APP_TO_APP_EVENT_TYPES.includes(type)) {
|
276
305
|
this.logger.warn(`[AppSession] Attempted to unsubscribe from App-to-App event type '${type}', which is not a valid stream.`);
|
277
306
|
return;
|
278
307
|
}
|
279
308
|
this.subscriptions.delete(type);
|
309
|
+
this.streamRates.delete(type); // also remove from our rate map
|
280
310
|
if (this.ws?.readyState === 1) {
|
281
311
|
this.updateSubscriptions();
|
282
312
|
}
|
@@ -306,6 +336,10 @@ class AppSession {
|
|
306
336
|
if (this.camera) {
|
307
337
|
this.camera.updateSessionId(sessionId);
|
308
338
|
}
|
339
|
+
// Update the sessionId in the audio module
|
340
|
+
if (this.audio) {
|
341
|
+
this.audio.updateSessionId(sessionId);
|
342
|
+
}
|
309
343
|
return new Promise((resolve, reject) => {
|
310
344
|
try {
|
311
345
|
// Clear previous resources if reconnecting
|
@@ -523,6 +557,10 @@ class AppSession {
|
|
523
557
|
if (this.camera) {
|
524
558
|
this.camera.cancelAllRequests();
|
525
559
|
}
|
560
|
+
// Clean up audio module
|
561
|
+
if (this.audio) {
|
562
|
+
this.audio.cancelAllRequests();
|
563
|
+
}
|
526
564
|
// Use the resource tracker to clean up everything
|
527
565
|
this.resources.dispose();
|
528
566
|
// Clean up additional resources not handled by the tracker
|
@@ -787,6 +825,14 @@ class AppSession {
|
|
787
825
|
// Update camera module's internal stream state
|
788
826
|
this.camera.updateStreamState(message);
|
789
827
|
}
|
828
|
+
else if ((0, cloud_to_app_1.isManagedStreamStatus)(message)) {
|
829
|
+
// Emit as a standard stream event if subscribed
|
830
|
+
if (this.subscriptions.has(types_1.StreamType.MANAGED_STREAM_STATUS)) {
|
831
|
+
this.events.emit(types_1.StreamType.MANAGED_STREAM_STATUS, message);
|
832
|
+
}
|
833
|
+
// Update camera module's managed stream state
|
834
|
+
this.camera.handleManagedStreamStatus(message);
|
835
|
+
}
|
790
836
|
else if ((0, types_1.isSettingsUpdate)(message)) {
|
791
837
|
// Store previous settings to check for changes
|
792
838
|
const prevSettings = [...this.settingsData];
|
@@ -917,6 +963,12 @@ class AppSession {
|
|
917
963
|
});
|
918
964
|
});
|
919
965
|
}
|
966
|
+
else if ((0, types_1.isAudioPlayResponse)(message)) {
|
967
|
+
// Delegate audio play response handling to the audio module
|
968
|
+
if (this.audio) {
|
969
|
+
this.audio.handleAudioPlayResponse(message);
|
970
|
+
}
|
971
|
+
}
|
920
972
|
else if ((0, cloud_to_app_1.isPhotoResponse)(message)) {
|
921
973
|
// Legacy photo response handling - now photos come directly via webhook
|
922
974
|
// This branch can be removed in the future as all photos now go through /photo-upload
|
@@ -924,19 +976,7 @@ class AppSession {
|
|
924
976
|
}
|
925
977
|
// Handle unrecognized message types gracefully
|
926
978
|
else {
|
927
|
-
|
928
|
-
messageType: message.type,
|
929
|
-
fullMessage: message,
|
930
|
-
messageKeys: Object.keys(message || {}),
|
931
|
-
messageStringified: JSON.stringify(message, null, 2)
|
932
|
-
});
|
933
|
-
// Log all message object details for debugging
|
934
|
-
this.logger.warn(`Unrecognized message type: ${message.type}. Full message details:`, {
|
935
|
-
messageType: message.type,
|
936
|
-
fullMessage: message,
|
937
|
-
messageKeys: Object.keys(message || {}),
|
938
|
-
messageStringified: JSON.stringify(message, null, 2)
|
939
|
-
});
|
979
|
+
this.logger.warn(`Unrecognized message type: ${message.type}`);
|
940
980
|
this.events.emit('error', new Error(`Unrecognized message type: ${message.type}`));
|
941
981
|
}
|
942
982
|
}
|
@@ -1073,10 +1113,18 @@ class AppSession {
|
|
1073
1113
|
*/
|
1074
1114
|
updateSubscriptions() {
|
1075
1115
|
this.logger.info(`[AppSession] updateSubscriptions: sending subscriptions to cloud:`, Array.from(this.subscriptions));
|
1116
|
+
// [MODIFIED] builds the array of SubscriptionRequest objects to send to the cloud
|
1117
|
+
const subscriptionPayload = Array.from(this.subscriptions).map(stream => {
|
1118
|
+
const rate = this.streamRates.get(stream);
|
1119
|
+
if (rate && stream === types_1.StreamType.LOCATION_STREAM) {
|
1120
|
+
return { stream: 'location_stream', rate: rate };
|
1121
|
+
}
|
1122
|
+
return stream;
|
1123
|
+
});
|
1076
1124
|
const message = {
|
1077
1125
|
type: types_1.AppToCloudMessageType.SUBSCRIPTION_UPDATE,
|
1078
1126
|
packageName: this.config.packageName,
|
1079
|
-
subscriptions:
|
1127
|
+
subscriptions: subscriptionPayload, // [MODIFIED]
|
1080
1128
|
sessionId: this.sessionId,
|
1081
1129
|
timestamp: new Date()
|
1082
1130
|
};
|
@@ -1232,7 +1280,7 @@ class AppSession {
|
|
1232
1280
|
userId: this.userId,
|
1233
1281
|
includeUserProfiles: includeProfiles
|
1234
1282
|
};
|
1235
|
-
const response = await
|
1283
|
+
const response = await (0, node_fetch_1.default)(url, {
|
1236
1284
|
method: 'POST',
|
1237
1285
|
headers: {
|
1238
1286
|
'Authorization': `Bearer ${appApiKey}`,
|
@@ -1450,6 +1498,8 @@ class TpaSession extends AppSession {
|
|
1450
1498
|
}
|
1451
1499
|
}
|
1452
1500
|
exports.TpaSession = TpaSession;
|
1453
|
-
// Export
|
1501
|
+
// Export module types for developers
|
1454
1502
|
var camera_2 = require("./modules/camera");
|
1455
1503
|
Object.defineProperty(exports, "CameraModule", { enumerable: true, get: function () { return camera_2.CameraModule; } });
|
1504
|
+
var audio_2 = require("./modules/audio");
|
1505
|
+
Object.defineProperty(exports, "AudioManager", { enumerable: true, get: function () { return audio_2.AudioManager; } });
|
@@ -0,0 +1,190 @@
|
|
1
|
+
/**
|
2
|
+
* ๐ Audio Module
|
3
|
+
*
|
4
|
+
* Audio functionality for App Sessions.
|
5
|
+
* Handles audio playback on connected glasses.
|
6
|
+
*/
|
7
|
+
import { AudioPlayResponse } from '../../../types';
|
8
|
+
import { Logger } from 'pino';
|
9
|
+
/**
|
10
|
+
* Options for audio playback
|
11
|
+
*/
|
12
|
+
export interface AudioPlayOptions {
|
13
|
+
/** URL to audio file for download and play */
|
14
|
+
audioUrl: string;
|
15
|
+
/** Volume level 0.0-1.0, defaults to 1.0 */
|
16
|
+
volume?: number;
|
17
|
+
/** Whether to stop other audio playback, defaults to true */
|
18
|
+
stopOtherAudio?: boolean;
|
19
|
+
}
|
20
|
+
/**
|
21
|
+
* Options for text-to-speech
|
22
|
+
*/
|
23
|
+
export interface SpeakOptions {
|
24
|
+
/** Voice ID to use (optional, defaults to server's ELEVENLABS_DEFAULT_VOICE_ID) */
|
25
|
+
voice_id?: string;
|
26
|
+
/** Model ID to use (optional, defaults to eleven_flash_v2_5) */
|
27
|
+
model_id?: string;
|
28
|
+
/** Voice settings object (optional) */
|
29
|
+
voice_settings?: {
|
30
|
+
stability?: number;
|
31
|
+
similarity_boost?: number;
|
32
|
+
style?: number;
|
33
|
+
use_speaker_boost?: boolean;
|
34
|
+
speed?: number;
|
35
|
+
};
|
36
|
+
/** Volume level 0.0-1.0, defaults to 1.0 */
|
37
|
+
volume?: number;
|
38
|
+
}
|
39
|
+
/**
|
40
|
+
* Result of audio playback attempt
|
41
|
+
*/
|
42
|
+
export interface AudioPlayResult {
|
43
|
+
/** Whether the audio playback was successful */
|
44
|
+
success: boolean;
|
45
|
+
/** Error message if playback failed */
|
46
|
+
error?: string;
|
47
|
+
/** Duration of the audio file in seconds (if available) */
|
48
|
+
duration?: number;
|
49
|
+
}
|
50
|
+
/**
|
51
|
+
* ๐ Audio Module Implementation
|
52
|
+
*
|
53
|
+
* Audio management for App Sessions.
|
54
|
+
* Provides methods for:
|
55
|
+
* - ๐ต Playing audio on glasses
|
56
|
+
* - โน๏ธ Stopping audio playback
|
57
|
+
* - ๐ Monitoring audio request status
|
58
|
+
* - ๐งน Cleanup and cancellation
|
59
|
+
*
|
60
|
+
* @example
|
61
|
+
* ```typescript
|
62
|
+
* // Play audio
|
63
|
+
* const result = await session.audio.playAudio({
|
64
|
+
* audioUrl: 'https://example.com/sound.mp3',
|
65
|
+
* volume: 0.8
|
66
|
+
* });
|
67
|
+
*
|
68
|
+
* // Stop all audio
|
69
|
+
* session.audio.stopAudio();
|
70
|
+
* ```
|
71
|
+
*/
|
72
|
+
export declare class AudioManager {
|
73
|
+
private send;
|
74
|
+
private packageName;
|
75
|
+
private sessionId;
|
76
|
+
private session?;
|
77
|
+
private logger;
|
78
|
+
/** Map to store pending audio play request promises */
|
79
|
+
private pendingAudioRequests;
|
80
|
+
/**
|
81
|
+
* Create a new AudioManager
|
82
|
+
*
|
83
|
+
* @param packageName - The App package name
|
84
|
+
* @param sessionId - The current session ID
|
85
|
+
* @param send - Function to send messages to the cloud
|
86
|
+
* @param session - Reference to the parent AppSession (optional)
|
87
|
+
* @param logger - Logger instance for debugging
|
88
|
+
*/
|
89
|
+
constructor(packageName: string, sessionId: string, send: (message: any) => void, session?: any, logger?: Logger);
|
90
|
+
/**
|
91
|
+
* ๐ Play audio on the connected glasses
|
92
|
+
* @param options - Audio playback configuration
|
93
|
+
* @returns Promise that resolves with playback result
|
94
|
+
*
|
95
|
+
* @example
|
96
|
+
* ```typescript
|
97
|
+
* // Play audio from URL
|
98
|
+
* const result = await session.audio.playAudio({
|
99
|
+
* audioUrl: 'https://example.com/sound.mp3',
|
100
|
+
* volume: 0.8
|
101
|
+
* });
|
102
|
+
* ```
|
103
|
+
*/
|
104
|
+
playAudio(options: AudioPlayOptions): Promise<AudioPlayResult>;
|
105
|
+
/**
|
106
|
+
* ๐ Stop audio playback on the connected glasses
|
107
|
+
*
|
108
|
+
* @example
|
109
|
+
* ```typescript
|
110
|
+
* // Stop all currently playing audio
|
111
|
+
* session.audio.stopAudio();
|
112
|
+
* ```
|
113
|
+
*/
|
114
|
+
stopAudio(): void;
|
115
|
+
/**
|
116
|
+
* ๐ฃ๏ธ Convert text to speech and play it on the connected glasses
|
117
|
+
* @param text - Text to convert to speech (required)
|
118
|
+
* @param options - Text-to-speech configuration (optional)
|
119
|
+
* @returns Promise that resolves with playback result
|
120
|
+
*
|
121
|
+
* @example
|
122
|
+
* ```typescript
|
123
|
+
* // Basic text-to-speech
|
124
|
+
* const result = await session.audio.speak('Hello, world!');
|
125
|
+
*
|
126
|
+
* // With custom voice settings
|
127
|
+
* const result = await session.audio.speak('Hello, world!', {
|
128
|
+
* voice_id: 'your_voice_id',
|
129
|
+
* voice_settings: {
|
130
|
+
* stability: 0.5,
|
131
|
+
* speed: 1.2
|
132
|
+
* },
|
133
|
+
* volume: 0.8
|
134
|
+
* });
|
135
|
+
* ```
|
136
|
+
*/
|
137
|
+
speak(text: string, options?: SpeakOptions): Promise<AudioPlayResult>;
|
138
|
+
/**
|
139
|
+
* ๐ฅ Handle audio play response from cloud
|
140
|
+
*
|
141
|
+
* This method is called internally when an audio play response is received.
|
142
|
+
* It resolves the corresponding pending promise with the response data.
|
143
|
+
*
|
144
|
+
* @param response - The audio play response received
|
145
|
+
* @internal This method is used internally by AppSession
|
146
|
+
*/
|
147
|
+
handleAudioPlayResponse(response: AudioPlayResponse): void;
|
148
|
+
/**
|
149
|
+
* ๐ Check if there are pending audio requests
|
150
|
+
* @param requestId - Optional specific request ID to check
|
151
|
+
* @returns True if there are pending requests (or specific request exists)
|
152
|
+
*/
|
153
|
+
hasPendingRequest(requestId?: string): boolean;
|
154
|
+
/**
|
155
|
+
* ๐ Get the number of pending audio requests
|
156
|
+
* @returns Number of pending requests
|
157
|
+
*/
|
158
|
+
getPendingRequestCount(): number;
|
159
|
+
/**
|
160
|
+
* ๐ Get all pending request IDs
|
161
|
+
* @returns Array of pending request IDs
|
162
|
+
*/
|
163
|
+
getPendingRequestIds(): string[];
|
164
|
+
/**
|
165
|
+
* โ Cancel a specific audio request
|
166
|
+
* @param requestId - The request ID to cancel
|
167
|
+
* @returns True if the request was found and cancelled
|
168
|
+
*/
|
169
|
+
cancelAudioRequest(requestId: string): boolean;
|
170
|
+
/**
|
171
|
+
* ๐งน Cancel all pending audio requests
|
172
|
+
* @returns Number of requests that were cancelled
|
173
|
+
*/
|
174
|
+
cancelAllAudioRequests(): number;
|
175
|
+
/**
|
176
|
+
* ๐ Update the session ID when reconnecting
|
177
|
+
* @param newSessionId - The new session ID
|
178
|
+
* @internal Used by AppSession during reconnection
|
179
|
+
*/
|
180
|
+
updateSessionId(newSessionId: string): void;
|
181
|
+
/**
|
182
|
+
* ๐งน Cancel all pending requests (cleanup)
|
183
|
+
* @returns Object with count of cancelled requests
|
184
|
+
* @internal Used by AppSession during cleanup
|
185
|
+
*/
|
186
|
+
cancelAllRequests(): {
|
187
|
+
audioRequests: number;
|
188
|
+
};
|
189
|
+
}
|
190
|
+
//# sourceMappingURL=audio.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../../../src/app/session/modules/audio.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,iBAAiB,EAGlB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAA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