@apocaliss92/scrypted-reolink-native 0.3.0 → 0.3.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/README.md +3 -1
- package/dist/main.nodejs.js +1 -1
- package/dist/plugin.zip +0 -0
- package/package.json +1 -1
- package/src/camera.ts +45 -7
package/dist/plugin.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/camera.ts
CHANGED
|
@@ -235,6 +235,14 @@ export class ReolinkCamera extends BaseBaichuanClass implements VideoCamera, Cam
|
|
|
235
235
|
defaultValue: 'default',
|
|
236
236
|
choices: ['default', 'autotrack', 'telephoto'] as NativeVideoStreamVariant[],
|
|
237
237
|
},
|
|
238
|
+
preferredStreams: {
|
|
239
|
+
type: 'string',
|
|
240
|
+
title: 'Preferred Stream Order',
|
|
241
|
+
description: 'Order preference for video streams. Default: RTSP -> RTMP -> Native',
|
|
242
|
+
defaultValue: 'Default',
|
|
243
|
+
choices: ['Default', 'Native', 'RTSP', 'RTMP'],
|
|
244
|
+
subgroup: 'Streaming',
|
|
245
|
+
},
|
|
238
246
|
// capabilities: {
|
|
239
247
|
// json: true,
|
|
240
248
|
// hide: true,
|
|
@@ -2406,11 +2414,33 @@ export class ReolinkCamera extends BaseBaichuanClass implements VideoCamera, Cam
|
|
|
2406
2414
|
compositeOnly: this.isMultiFocal,
|
|
2407
2415
|
})}`);
|
|
2408
2416
|
|
|
2409
|
-
//
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2417
|
+
// Update preferredStreams choices based on supported stream types
|
|
2418
|
+
const availableChoices = ['Default'];
|
|
2419
|
+
if (nativeStreams.length > 0) availableChoices.push('Native');
|
|
2420
|
+
if (rtspStreams.length > 0) availableChoices.push('RTSP');
|
|
2421
|
+
if (rtmpStreams.length > 0) availableChoices.push('RTMP');
|
|
2422
|
+
|
|
2423
|
+
this.storageSettings.settings.preferredStreams.choices = availableChoices;
|
|
2424
|
+
|
|
2425
|
+
// Order streams based on preferredStreams setting
|
|
2426
|
+
const preferredOrder = this.storageSettings.values.preferredStreams || 'Default';
|
|
2427
|
+
let supportedStreams: any[] = [];
|
|
2428
|
+
|
|
2429
|
+
if (preferredOrder === 'Default') {
|
|
2430
|
+
// Default: Native -> RTSP -> RTMP
|
|
2431
|
+
supportedStreams = [...nativeStreams, ...rtspStreams, ...rtmpStreams];
|
|
2432
|
+
// // Default: RTSP -> RTMP -> Native
|
|
2433
|
+
// supportedStreams = [...rtspStreams, ...rtmpStreams, ...nativeStreams];
|
|
2434
|
+
} else if (preferredOrder === 'Native') {
|
|
2435
|
+
supportedStreams = [...nativeStreams, ...rtspStreams, ...rtmpStreams];
|
|
2436
|
+
} else if (preferredOrder === 'RTSP') {
|
|
2437
|
+
supportedStreams = [...rtspStreams, ...rtmpStreams, ...nativeStreams];
|
|
2438
|
+
} else if (preferredOrder === 'RTMP') {
|
|
2439
|
+
supportedStreams = [...rtmpStreams, ...rtspStreams, ...nativeStreams];
|
|
2440
|
+
} else {
|
|
2441
|
+
// Fallback to default
|
|
2442
|
+
supportedStreams = [...rtspStreams, ...rtmpStreams, ...nativeStreams];
|
|
2443
|
+
}
|
|
2414
2444
|
|
|
2415
2445
|
for (const supportedStream of supportedStreams) {
|
|
2416
2446
|
const { id, metadata, url, name, container, lens, channel, profile, nativeVariant } = supportedStream;
|
|
@@ -2500,8 +2530,16 @@ export class ReolinkCamera extends BaseBaichuanClass implements VideoCamera, Cam
|
|
|
2500
2530
|
return await this.createMediaObject(ret, ScryptedMimeTypes.MediaStreamUrl);
|
|
2501
2531
|
}
|
|
2502
2532
|
|
|
2533
|
+
// Ensure streamManager is initialized before use
|
|
2503
2534
|
if (!this.streamManager) {
|
|
2504
|
-
|
|
2535
|
+
const logger = this.getBaichuanLogger();
|
|
2536
|
+
logger.warn('StreamManager not initialized, initializing now...');
|
|
2537
|
+
try {
|
|
2538
|
+
this.initStreamManager(logger);
|
|
2539
|
+
} catch (e) {
|
|
2540
|
+
logger.error('Failed to initialize StreamManager in getVideoStream', e?.message || String(e), e);
|
|
2541
|
+
throw e;
|
|
2542
|
+
}
|
|
2505
2543
|
}
|
|
2506
2544
|
|
|
2507
2545
|
const streamKey = selected.id;
|
|
@@ -2698,7 +2736,7 @@ export class ReolinkCamera extends BaseBaichuanClass implements VideoCamera, Cam
|
|
|
2698
2736
|
this.initStreamManager();
|
|
2699
2737
|
}
|
|
2700
2738
|
catch (e) {
|
|
2701
|
-
logger.error('Failed to initialize StreamManager', e?.message || String(e));
|
|
2739
|
+
logger.error('Failed to initialize StreamManager in init', e?.message || String(e), e);
|
|
2702
2740
|
}
|
|
2703
2741
|
|
|
2704
2742
|
const { hasIntercom, hasPtz } = await this.getAbilities();
|