@mentra/sdk 2.0.4 โ 2.1.1
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/server/index.d.ts +10 -1
- package/dist/app/server/index.d.ts.map +1 -1
- package/dist/app/server/index.js +90 -1
- package/dist/app/session/index.d.ts +4 -13
- package/dist/app/session/index.d.ts.map +1 -1
- package/dist/app/session/index.js +22 -57
- package/dist/app/session/modules/camera.d.ts +230 -0
- package/dist/app/session/modules/camera.d.ts.map +1 -0
- package/dist/app/session/modules/camera.js +439 -0
- package/dist/examples/rtmp-streaming-example.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/messages/app-to-cloud.d.ts +1 -0
- package/dist/types/messages/app-to-cloud.d.ts.map +1 -1
- package/dist/types/messages/cloud-to-glasses.d.ts +1 -0
- package/dist/types/messages/cloud-to-glasses.d.ts.map +1 -1
- package/dist/types/messages/glasses-to-cloud.d.ts +3 -0
- package/dist/types/messages/glasses-to-cloud.d.ts.map +1 -1
- package/dist/types/photo-data.d.ts +18 -0
- package/dist/types/photo-data.d.ts.map +1 -0
- package/dist/types/photo-data.js +2 -0
- package/dist/types/rtmp-stream.d.ts +2 -2
- package/package.json +2 -2
- package/dist/app/session/modules/streaming.d.ts +0 -100
- package/dist/app/session/modules/streaming.d.ts.map +0 -1
- package/dist/app/session/modules/streaming.js +0 -270
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* ๐ App Server Module
|
3
3
|
*
|
4
|
-
* Creates and manages a server for
|
4
|
+
* Creates and manages a server for Apps in the MentraOS ecosystem.
|
5
5
|
* Handles webhook endpoints, session management, and cleanup.
|
6
6
|
*/
|
7
7
|
import { type Express } from 'express';
|
@@ -189,6 +189,15 @@ export declare class AppServer {
|
|
189
189
|
* Closes all active sessions and runs cleanup handlers.
|
190
190
|
*/
|
191
191
|
private cleanup;
|
192
|
+
/**
|
193
|
+
* ๐ฏ Setup Photo Upload Endpoint
|
194
|
+
* Creates a /photo-upload endpoint for receiving photos directly from ASG glasses
|
195
|
+
*/
|
196
|
+
private setupPhotoUploadEndpoint;
|
197
|
+
/**
|
198
|
+
* Find session that has a pending photo request for the given requestId
|
199
|
+
*/
|
200
|
+
private findSessionByPhotoRequestId;
|
192
201
|
}
|
193
202
|
/**
|
194
203
|
* @deprecated Use `AppServerConfig` instead. `TpaServerConfig` is deprecated and will be removed in a future version.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/server/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAgB,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAQL,QAAQ,EACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAI9B;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAe;IAC9B,oIAAoI;IACpI,WAAW,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,+FAA+F;IAC/F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAE3B,iEAAiE;IACjE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,SAAS;IAYR,OAAO,CAAC,MAAM;IAX1B,2B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;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,qBAAa,SAAU,SAAQ,SAAS;gBAC1B,MAAM,EAAE,eAAe;CASpC"}
|
package/dist/app/server/index.js
CHANGED
@@ -7,7 +7,7 @@ exports.TpaServer = exports.AppServer = void 0;
|
|
7
7
|
/**
|
8
8
|
* ๐ App Server Module
|
9
9
|
*
|
10
|
-
* Creates and manages a server for
|
10
|
+
* Creates and manages a server for Apps in the MentraOS ecosystem.
|
11
11
|
* Handles webhook endpoints, session management, and cleanup.
|
12
12
|
*/
|
13
13
|
const express_1 = __importDefault(require("express"));
|
@@ -81,6 +81,7 @@ class AppServer {
|
|
81
81
|
this.setupSettingsEndpoint();
|
82
82
|
this.setupHealthCheck();
|
83
83
|
this.setupToolCallEndpoint();
|
84
|
+
this.setupPhotoUploadEndpoint();
|
84
85
|
this.setupPublicDir();
|
85
86
|
this.setupShutdown();
|
86
87
|
}
|
@@ -432,6 +433,94 @@ class AppServer {
|
|
432
433
|
// Run cleanup handlers
|
433
434
|
this.cleanupHandlers.forEach(handler => handler());
|
434
435
|
}
|
436
|
+
/**
|
437
|
+
* ๐ฏ Setup Photo Upload Endpoint
|
438
|
+
* Creates a /photo-upload endpoint for receiving photos directly from ASG glasses
|
439
|
+
*/
|
440
|
+
setupPhotoUploadEndpoint() {
|
441
|
+
const multer = require('multer');
|
442
|
+
// Configure multer for handling multipart form data
|
443
|
+
const upload = multer({
|
444
|
+
storage: multer.memoryStorage(),
|
445
|
+
limits: {
|
446
|
+
fileSize: 10 * 1024 * 1024, // 10MB limit
|
447
|
+
},
|
448
|
+
fileFilter: (req, file, cb) => {
|
449
|
+
// Accept image files only
|
450
|
+
if (file.mimetype && file.mimetype.startsWith('image/')) {
|
451
|
+
cb(null, true);
|
452
|
+
}
|
453
|
+
else {
|
454
|
+
cb(new Error('Only image files are allowed'), false);
|
455
|
+
}
|
456
|
+
}
|
457
|
+
});
|
458
|
+
this.app.post('/photo-upload', upload.single('photo'), async (req, res) => {
|
459
|
+
try {
|
460
|
+
const { requestId, type } = req.body;
|
461
|
+
const photoFile = req.file;
|
462
|
+
this.logger.info({ requestId, type }, `๐ธ Received photo upload: ${requestId}`);
|
463
|
+
if (!photoFile) {
|
464
|
+
this.logger.error({ requestId }, 'No photo file in upload');
|
465
|
+
return res.status(400).json({
|
466
|
+
success: false,
|
467
|
+
error: 'No photo file provided'
|
468
|
+
});
|
469
|
+
}
|
470
|
+
if (!requestId) {
|
471
|
+
this.logger.error('No requestId in photo upload');
|
472
|
+
return res.status(400).json({
|
473
|
+
success: false,
|
474
|
+
error: 'No requestId provided'
|
475
|
+
});
|
476
|
+
}
|
477
|
+
// Find the corresponding session that made this photo request
|
478
|
+
const session = this.findSessionByPhotoRequestId(requestId);
|
479
|
+
if (!session) {
|
480
|
+
this.logger.warn({ requestId }, 'No active session found for photo request');
|
481
|
+
return res.status(404).json({
|
482
|
+
success: false,
|
483
|
+
error: 'No active session found for this photo request'
|
484
|
+
});
|
485
|
+
}
|
486
|
+
// Create photo data object
|
487
|
+
const photoData = {
|
488
|
+
buffer: photoFile.buffer,
|
489
|
+
mimeType: photoFile.mimetype,
|
490
|
+
filename: photoFile.originalname || 'photo.jpg',
|
491
|
+
requestId,
|
492
|
+
size: photoFile.size,
|
493
|
+
timestamp: new Date()
|
494
|
+
};
|
495
|
+
// Deliver photo to the session
|
496
|
+
session.camera.handlePhotoReceived(photoData);
|
497
|
+
// Respond to ASG client
|
498
|
+
res.json({
|
499
|
+
success: true,
|
500
|
+
requestId,
|
501
|
+
message: 'Photo received successfully'
|
502
|
+
});
|
503
|
+
}
|
504
|
+
catch (error) {
|
505
|
+
this.logger.error(error, 'โ Error handling photo upload');
|
506
|
+
res.status(500).json({
|
507
|
+
success: false,
|
508
|
+
error: 'Internal server error processing photo upload'
|
509
|
+
});
|
510
|
+
}
|
511
|
+
});
|
512
|
+
}
|
513
|
+
/**
|
514
|
+
* Find session that has a pending photo request for the given requestId
|
515
|
+
*/
|
516
|
+
findSessionByPhotoRequestId(requestId) {
|
517
|
+
for (const [sessionId, session] of this.activeSessions) {
|
518
|
+
if (session.camera.hasPhotoPendingRequest(requestId)) {
|
519
|
+
return session;
|
520
|
+
}
|
521
|
+
}
|
522
|
+
return undefined;
|
523
|
+
}
|
435
524
|
}
|
436
525
|
exports.AppServer = AppServer;
|
437
526
|
/**
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EventManager, EventData } from './events';
|
2
2
|
import { LayoutManager } from './layouts';
|
3
3
|
import { SettingsManager } from './settings';
|
4
|
-
import {
|
4
|
+
import { CameraModule } from './modules/camera';
|
5
5
|
import { ExtendedStreamType, ButtonPress, HeadPosition, PhoneNotification, TranscriptionData, TranslationData, AppSettings, AppSetting, AppConfig, VpsCoordinates, PhotoTaken, Capabilities } from '../../types';
|
6
6
|
import { DashboardAPI } from '../../types/dashboard';
|
7
7
|
import { Logger } from 'pino';
|
@@ -83,8 +83,6 @@ export declare class AppSession {
|
|
83
83
|
private subscriptionSettingsHandler?;
|
84
84
|
/** Settings that should trigger subscription updates when changed */
|
85
85
|
private subscriptionUpdateTriggers;
|
86
|
-
/** Pending photo requests waiting for responses */
|
87
|
-
private pendingPhotoRequests;
|
88
86
|
/** Pending user discovery requests waiting for responses */
|
89
87
|
private pendingUserDiscoveryRequests;
|
90
88
|
/** Pending direct message requests waiting for responses */
|
@@ -97,8 +95,8 @@ export declare class AppSession {
|
|
97
95
|
readonly settings: SettingsManager;
|
98
96
|
/** ๐ Dashboard management interface */
|
99
97
|
readonly dashboard: DashboardAPI;
|
100
|
-
/**
|
101
|
-
readonly
|
98
|
+
/** ๐ท Camera interface for photos and streaming */
|
99
|
+
readonly camera: CameraModule;
|
102
100
|
readonly appServer: AppServer;
|
103
101
|
readonly logger: Logger;
|
104
102
|
readonly userId: string;
|
@@ -201,14 +199,6 @@ export declare class AppSession {
|
|
201
199
|
* ๐ Disconnect from MentraOS Cloud
|
202
200
|
*/
|
203
201
|
disconnect(): void;
|
204
|
-
/**
|
205
|
-
* ๐ธ Request a photo from the connected glasses
|
206
|
-
* @param options - Optional configuration for the photo request
|
207
|
-
* @returns Promise that resolves with the URL to the captured photo
|
208
|
-
*/
|
209
|
-
requestPhoto(options?: {
|
210
|
-
saveToGallery?: boolean;
|
211
|
-
}): Promise<string>;
|
212
202
|
/**
|
213
203
|
* ๐ ๏ธ Get all current user settings
|
214
204
|
* @returns A copy of the current settings array
|
@@ -425,4 +415,5 @@ export type TpaSessionConfig = AppSessionConfig;
|
|
425
415
|
export declare class TpaSession extends AppSession {
|
426
416
|
constructor(config: TpaSessionConfig);
|
427
417
|
}
|
418
|
+
export { CameraModule, PhotoRequestOptions, RtmpStreamOptions } from './modules/camera';
|
428
419
|
//# 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,EAAmB,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/session/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAmB,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,YAAY,EAA0C,MAAM,kBAAkB,CAAC;AAExF,OAAO,EAYL,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAYf,WAAW,EACX,UAAU,EACV,SAAS,EAQT,cAAc,EACd,UAAU,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MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,QAAQ,CAAC,EAAE,GAAG,CAAC;KAChB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBjB;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBjD;;;;OAIG;IACH,YAAY,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,IAAI;IAKzD;;;;OAIG;IACH,eAAe,CAAC,OAAO,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"}
|
@@ -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.TpaSession = exports.AppSession = void 0;
|
6
|
+
exports.CameraModule = exports.TpaSession = exports.AppSession = void 0;
|
7
7
|
/**
|
8
8
|
* ๐ฏ App Session Module
|
9
9
|
*
|
@@ -14,7 +14,7 @@ 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
|
17
|
+
const camera_1 = require("./modules/camera");
|
18
18
|
const resource_tracker_1 = require("../../utils/resource-tracker");
|
19
19
|
const types_1 = require("../../types");
|
20
20
|
const axios_1 = __importDefault(require("axios"));
|
@@ -76,8 +76,6 @@ class AppSession {
|
|
76
76
|
this.shouldUpdateSubscriptionsOnSettingsChange = false;
|
77
77
|
/** Settings that should trigger subscription updates when changed */
|
78
78
|
this.subscriptionUpdateTriggers = [];
|
79
|
-
/** Pending photo requests waiting for responses */
|
80
|
-
this.pendingPhotoRequests = new Map();
|
81
79
|
/** Pending user discovery requests waiting for responses */
|
82
80
|
this.pendingUserDiscoveryRequests = new Map();
|
83
81
|
/** Pending direct message requests waiting for responses */
|
@@ -155,9 +153,9 @@ class AppSession {
|
|
155
153
|
// Import DashboardManager dynamically to avoid circular dependency
|
156
154
|
const { DashboardManager } = require('./dashboard');
|
157
155
|
this.dashboard = new DashboardManager(this, this.send.bind(this));
|
158
|
-
// Initialize
|
159
|
-
this.
|
160
|
-
);
|
156
|
+
// Initialize camera module with session reference
|
157
|
+
this.camera = new camera_1.CameraModule(this.config.packageName, this.sessionId || 'unknown-session-id', this.send.bind(this), this, // Pass session reference
|
158
|
+
this.logger.child({ module: 'camera' }));
|
161
159
|
}
|
162
160
|
/**
|
163
161
|
* Get the current session ID
|
@@ -304,9 +302,9 @@ class AppSession {
|
|
304
302
|
// Configure settings API client with the WebSocket URL and session ID
|
305
303
|
// This allows settings to be fetched from the correct server
|
306
304
|
this.settings.configureApiClient(this.config.packageName, this.config.mentraOSWebsocketUrl || '', sessionId);
|
307
|
-
// Update the sessionId in the
|
308
|
-
if (this.
|
309
|
-
|
305
|
+
// Update the sessionId in the camera module
|
306
|
+
if (this.camera) {
|
307
|
+
this.camera.updateSessionId(sessionId);
|
310
308
|
}
|
311
309
|
return new Promise((resolve, reject) => {
|
312
310
|
try {
|
@@ -521,6 +519,10 @@ class AppSession {
|
|
521
519
|
* ๐ Disconnect from MentraOS Cloud
|
522
520
|
*/
|
523
521
|
disconnect() {
|
522
|
+
// Clean up camera module first
|
523
|
+
if (this.camera) {
|
524
|
+
this.camera.cancelAllRequests();
|
525
|
+
}
|
524
526
|
// Use the resource tracker to clean up everything
|
525
527
|
this.resources.dispose();
|
526
528
|
// Clean up additional resources not handled by the tracker
|
@@ -529,43 +531,6 @@ class AppSession {
|
|
529
531
|
this.subscriptions.clear();
|
530
532
|
this.reconnectAttempts = 0;
|
531
533
|
}
|
532
|
-
/**
|
533
|
-
* ๐ธ Request a photo from the connected glasses
|
534
|
-
* @param options - Optional configuration for the photo request
|
535
|
-
* @returns Promise that resolves with the URL to the captured photo
|
536
|
-
*/
|
537
|
-
requestPhoto(options) {
|
538
|
-
return new Promise((resolve, reject) => {
|
539
|
-
try {
|
540
|
-
// Generate unique request ID
|
541
|
-
const requestId = `photo_req_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
542
|
-
// Store promise resolvers for when we get the response
|
543
|
-
this.pendingPhotoRequests.set(requestId, { resolve, reject });
|
544
|
-
// Create photo request message
|
545
|
-
const message = {
|
546
|
-
type: types_1.AppToCloudMessageType.PHOTO_REQUEST,
|
547
|
-
packageName: this.config.packageName,
|
548
|
-
sessionId: this.sessionId,
|
549
|
-
timestamp: new Date(),
|
550
|
-
saveToGallery: options?.saveToGallery || false
|
551
|
-
};
|
552
|
-
// Send request to cloud
|
553
|
-
this.send(message);
|
554
|
-
// Set timeout to avoid hanging promises
|
555
|
-
const timeoutMs = 30000; // 30 seconds
|
556
|
-
this.resources.setTimeout(() => {
|
557
|
-
if (this.pendingPhotoRequests.has(requestId)) {
|
558
|
-
this.pendingPhotoRequests.get(requestId).reject(new Error('Photo request timed out'));
|
559
|
-
this.pendingPhotoRequests.delete(requestId);
|
560
|
-
}
|
561
|
-
}, timeoutMs);
|
562
|
-
}
|
563
|
-
catch (error) {
|
564
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
565
|
-
reject(new Error(`Failed to request photo: ${errorMessage}`));
|
566
|
-
}
|
567
|
-
});
|
568
|
-
}
|
569
534
|
/**
|
570
535
|
* ๐ ๏ธ Get all current user settings
|
571
536
|
* @returns A copy of the current settings array
|
@@ -814,21 +779,13 @@ class AppSession {
|
|
814
779
|
this.events.emit(messageStreamType, sanitizedData);
|
815
780
|
}
|
816
781
|
}
|
817
|
-
else if ((0, cloud_to_app_1.isPhotoResponse)(message)) {
|
818
|
-
// Handle photo response by resolving the pending promise
|
819
|
-
if (this.pendingPhotoRequests.has(message.requestId)) {
|
820
|
-
const { resolve } = this.pendingPhotoRequests.get(message.requestId);
|
821
|
-
resolve(message.photoUrl);
|
822
|
-
this.pendingPhotoRequests.delete(message.requestId);
|
823
|
-
}
|
824
|
-
}
|
825
782
|
else if ((0, cloud_to_app_1.isRtmpStreamStatus)(message)) {
|
826
783
|
// Emit as a standard stream event if subscribed
|
827
784
|
if (this.subscriptions.has(types_1.StreamType.RTMP_STREAM_STATUS)) {
|
828
785
|
this.events.emit(types_1.StreamType.RTMP_STREAM_STATUS, message);
|
829
786
|
}
|
830
|
-
// Update
|
831
|
-
this.
|
787
|
+
// Update camera module's internal stream state
|
788
|
+
this.camera.updateStreamState(message);
|
832
789
|
}
|
833
790
|
else if ((0, types_1.isSettingsUpdate)(message)) {
|
834
791
|
// Store previous settings to check for changes
|
@@ -960,6 +917,11 @@ class AppSession {
|
|
960
917
|
});
|
961
918
|
});
|
962
919
|
}
|
920
|
+
else if ((0, cloud_to_app_1.isPhotoResponse)(message)) {
|
921
|
+
// Legacy photo response handling - now photos come directly via webhook
|
922
|
+
// This branch can be removed in the future as all photos now go through /photo-upload
|
923
|
+
this.logger.warn('Received legacy photo response - photos should now come via /photo-upload webhook');
|
924
|
+
}
|
963
925
|
// Handle unrecognized message types gracefully
|
964
926
|
else {
|
965
927
|
console.log(`Unrecognized message type: ${message.type}. Full message details:`, {
|
@@ -1488,3 +1450,6 @@ class TpaSession extends AppSession {
|
|
1488
1450
|
}
|
1489
1451
|
}
|
1490
1452
|
exports.TpaSession = TpaSession;
|
1453
|
+
// Export camera module types for developers
|
1454
|
+
var camera_2 = require("./modules/camera");
|
1455
|
+
Object.defineProperty(exports, "CameraModule", { enumerable: true, get: function () { return camera_2.CameraModule; } });
|
@@ -0,0 +1,230 @@
|
|
1
|
+
/**
|
2
|
+
* ๐ท Camera Module
|
3
|
+
*
|
4
|
+
* Unified camera functionality for App Sessions.
|
5
|
+
* Handles both photo requests and RTMP streaming from connected glasses.
|
6
|
+
*/
|
7
|
+
import { PhotoData, RtmpStreamStatus } from '../../../types';
|
8
|
+
import { VideoConfig, AudioConfig, StreamConfig, StreamStatusHandler } from '../../../types/rtmp-stream';
|
9
|
+
import { Logger } from 'pino';
|
10
|
+
/**
|
11
|
+
* Options for photo requests
|
12
|
+
*/
|
13
|
+
export interface PhotoRequestOptions {
|
14
|
+
/** Whether to save the photo to the device gallery */
|
15
|
+
saveToGallery?: boolean;
|
16
|
+
}
|
17
|
+
/**
|
18
|
+
* Configuration options for an RTMP stream
|
19
|
+
*/
|
20
|
+
export interface RtmpStreamOptions {
|
21
|
+
/** The RTMP URL to stream to (e.g., rtmp://server.example.com/live/stream-key) */
|
22
|
+
rtmpUrl: string;
|
23
|
+
/** Optional video configuration settings */
|
24
|
+
video?: VideoConfig;
|
25
|
+
/** Optional audio configuration settings */
|
26
|
+
audio?: AudioConfig;
|
27
|
+
/** Optional stream configuration settings */
|
28
|
+
stream?: StreamConfig;
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* ๐ท Camera Module Implementation
|
32
|
+
*
|
33
|
+
* Unified camera management for App Sessions.
|
34
|
+
* Provides methods for:
|
35
|
+
* - ๐ธ Requesting photos from glasses
|
36
|
+
* - ๐น Starting/stopping RTMP streams
|
37
|
+
* - ๐ Monitoring photo and stream status
|
38
|
+
* - ๐งน Cleanup and cancellation
|
39
|
+
*
|
40
|
+
* @example
|
41
|
+
* ```typescript
|
42
|
+
* // Request a photo
|
43
|
+
* const photoData = await session.camera.requestPhoto({ saveToGallery: true });
|
44
|
+
*
|
45
|
+
* // Start streaming
|
46
|
+
* await session.camera.startStream({ rtmpUrl: 'rtmp://example.com/live/key' });
|
47
|
+
*
|
48
|
+
* // Monitor stream status
|
49
|
+
* session.camera.onStreamStatus((status) => {
|
50
|
+
* console.log('Stream status:', status.status);
|
51
|
+
* });
|
52
|
+
*
|
53
|
+
* // Stop streaming
|
54
|
+
* await session.camera.stopStream();
|
55
|
+
* ```
|
56
|
+
*/
|
57
|
+
export declare class CameraModule {
|
58
|
+
private send;
|
59
|
+
private packageName;
|
60
|
+
private sessionId;
|
61
|
+
private session?;
|
62
|
+
private logger;
|
63
|
+
/** Map to store pending photo request promises */
|
64
|
+
private pendingPhotoRequests;
|
65
|
+
private isStreaming;
|
66
|
+
private currentStreamUrl?;
|
67
|
+
private currentStreamState?;
|
68
|
+
/**
|
69
|
+
* Create a new CameraModule
|
70
|
+
*
|
71
|
+
* @param packageName - The App package name
|
72
|
+
* @param sessionId - The current session ID
|
73
|
+
* @param send - Function to send messages to the cloud
|
74
|
+
* @param session - Reference to the parent AppSession (optional)
|
75
|
+
* @param logger - Logger instance for debugging
|
76
|
+
*/
|
77
|
+
constructor(packageName: string, sessionId: string, send: (message: any) => void, session?: any, logger?: Logger);
|
78
|
+
/**
|
79
|
+
* ๐ธ Request a photo from the connected glasses
|
80
|
+
*
|
81
|
+
* @param options - Optional configuration for the photo request
|
82
|
+
* @returns Promise that resolves with the actual photo data
|
83
|
+
*
|
84
|
+
* @example
|
85
|
+
* ```typescript
|
86
|
+
* // Request a photo
|
87
|
+
* const photo = await session.camera.requestPhoto();
|
88
|
+
* ```
|
89
|
+
*/
|
90
|
+
requestPhoto(options?: PhotoRequestOptions): Promise<PhotoData>;
|
91
|
+
/**
|
92
|
+
* ๐ฅ Handle photo received from /photo-upload endpoint
|
93
|
+
*
|
94
|
+
* This method is called internally when a photo response is received.
|
95
|
+
* It resolves the corresponding pending promise with the photo data.
|
96
|
+
*
|
97
|
+
* @param photoData - The photo data received
|
98
|
+
* @internal This method is used internally by AppSession
|
99
|
+
*/
|
100
|
+
handlePhotoReceived(photoData: PhotoData): void;
|
101
|
+
/**
|
102
|
+
* ๐ Check if there's a pending photo request for the given request ID
|
103
|
+
*
|
104
|
+
* @param requestId - The request ID to check
|
105
|
+
* @returns true if there's a pending request
|
106
|
+
*/
|
107
|
+
hasPhotoPendingRequest(requestId: string): boolean;
|
108
|
+
/**
|
109
|
+
* ๐ Get the number of pending photo requests
|
110
|
+
*
|
111
|
+
* @returns Number of pending photo requests
|
112
|
+
*/
|
113
|
+
getPhotoPendingRequestCount(): number;
|
114
|
+
/**
|
115
|
+
* ๐ Get all pending photo request IDs
|
116
|
+
*
|
117
|
+
* @returns Array of pending request IDs
|
118
|
+
*/
|
119
|
+
getPhotoPendingRequestIds(): string[];
|
120
|
+
/**
|
121
|
+
* โ Cancel a pending photo request
|
122
|
+
*
|
123
|
+
* @param requestId - The request ID to cancel
|
124
|
+
* @returns true if the request was cancelled, false if it wasn't found
|
125
|
+
*/
|
126
|
+
cancelPhotoRequest(requestId: string): boolean;
|
127
|
+
/**
|
128
|
+
* ๐งน Cancel all pending photo requests
|
129
|
+
*
|
130
|
+
* @returns Number of requests that were cancelled
|
131
|
+
*/
|
132
|
+
cancelAllPhotoRequests(): number;
|
133
|
+
/**
|
134
|
+
* ๐น Start an RTMP stream to the specified URL
|
135
|
+
*
|
136
|
+
* @param options - Configuration options for the stream
|
137
|
+
* @returns Promise that resolves when the stream request is sent (not when streaming begins)
|
138
|
+
*
|
139
|
+
* @example
|
140
|
+
* ```typescript
|
141
|
+
* await session.camera.startStream({
|
142
|
+
* rtmpUrl: 'rtmp://live.example.com/stream/key',
|
143
|
+
* video: { resolution: '1920x1080', bitrate: 5000 },
|
144
|
+
* audio: { bitrate: 128 }
|
145
|
+
* });
|
146
|
+
* ```
|
147
|
+
*/
|
148
|
+
startStream(options: RtmpStreamOptions): Promise<void>;
|
149
|
+
/**
|
150
|
+
* ๐ Stop the current RTMP stream
|
151
|
+
*
|
152
|
+
* @returns Promise that resolves when the stop request is sent
|
153
|
+
*
|
154
|
+
* @example
|
155
|
+
* ```typescript
|
156
|
+
* await session.camera.stopStream();
|
157
|
+
* ```
|
158
|
+
*/
|
159
|
+
stopStream(): Promise<void>;
|
160
|
+
/**
|
161
|
+
* ๐ Check if currently streaming
|
162
|
+
*
|
163
|
+
* @returns True if a stream is active or initializing
|
164
|
+
*/
|
165
|
+
isCurrentlyStreaming(): boolean;
|
166
|
+
/**
|
167
|
+
* ๐ Get the URL of the current stream (if any)
|
168
|
+
*
|
169
|
+
* @returns The RTMP URL of the current stream, or undefined if not streaming
|
170
|
+
*/
|
171
|
+
getCurrentStreamUrl(): string | undefined;
|
172
|
+
/**
|
173
|
+
* ๐ Get the current stream status
|
174
|
+
*
|
175
|
+
* @returns The current stream status, or undefined if not available
|
176
|
+
*/
|
177
|
+
getStreamStatus(): RtmpStreamStatus | undefined;
|
178
|
+
/**
|
179
|
+
* ๐บ Subscribe to RTMP stream status updates
|
180
|
+
* This uses the standard stream subscription mechanism
|
181
|
+
*/
|
182
|
+
subscribeToStreamStatusUpdates(): void;
|
183
|
+
/**
|
184
|
+
* ๐บ Unsubscribe from RTMP stream status updates
|
185
|
+
*/
|
186
|
+
unsubscribeFromStreamStatusUpdates(): void;
|
187
|
+
/**
|
188
|
+
* ๐ Listen for stream status updates using the standard event system
|
189
|
+
* @param handler - Function to call when stream status changes
|
190
|
+
* @returns Cleanup function to remove the handler
|
191
|
+
*
|
192
|
+
* @example
|
193
|
+
* ```typescript
|
194
|
+
* const cleanup = session.camera.onStreamStatus((status) => {
|
195
|
+
* console.log('Stream status:', status.status);
|
196
|
+
* if (status.status === 'error') {
|
197
|
+
* console.error('Stream error:', status.errorDetails);
|
198
|
+
* }
|
199
|
+
* });
|
200
|
+
*
|
201
|
+
* // Later, cleanup the listener
|
202
|
+
* cleanup();
|
203
|
+
* ```
|
204
|
+
*/
|
205
|
+
onStreamStatus(handler: StreamStatusHandler): () => void;
|
206
|
+
/**
|
207
|
+
* ๐ Update internal stream state based on a status message
|
208
|
+
* For internal use by AppSession
|
209
|
+
* @param message - The status message from the cloud
|
210
|
+
* @internal This method is used internally by AppSession
|
211
|
+
*/
|
212
|
+
updateStreamState(message: any): void;
|
213
|
+
/**
|
214
|
+
* ๐ง Update the session ID (used when reconnecting)
|
215
|
+
*
|
216
|
+
* @param newSessionId - The new session ID
|
217
|
+
* @internal This method is used internally by AppSession
|
218
|
+
*/
|
219
|
+
updateSessionId(newSessionId: string): void;
|
220
|
+
/**
|
221
|
+
* ๐งน Cancel all pending requests and clean up resources
|
222
|
+
*
|
223
|
+
* @returns Object with counts of cancelled requests
|
224
|
+
*/
|
225
|
+
cancelAllRequests(): {
|
226
|
+
photoRequests: number;
|
227
|
+
};
|
228
|
+
}
|
229
|
+
export { VideoConfig, AudioConfig, StreamConfig, StreamStatusHandler };
|
230
|
+
//# sourceMappingURL=camera.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../../../src/app/session/modules/camera.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,SAAS,EAIT,gBAAgB,EAEjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,WAAW,EACX,WAAW,EACX,YAAY,EACZ,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,sDAAsD;IACtD,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,4CAA4C;I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