moqtail 0.7.0 → 0.8.0
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 +9 -6
- package/dist/{byte_buffer-BOK6VPTF.d.cts → byte_buffer-BM4uNj4n.d.cts} +136 -13
- package/dist/{byte_buffer-BOK6VPTF.d.ts → byte_buffer-BM4uNj4n.d.ts} +136 -13
- package/dist/client/index.cjs +543 -132
- package/dist/client/index.d.cts +153 -67
- package/dist/client/index.d.ts +153 -67
- package/dist/client/index.js +542 -133
- package/dist/index.cjs +548 -174
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +547 -174
- package/dist/model/index.cjs +156 -93
- package/dist/model/index.d.cts +3 -3
- package/dist/model/index.d.ts +3 -3
- package/dist/model/index.js +156 -93
- package/dist/util/index.cjs +52 -47
- package/dist/util/index.d.cts +2 -43
- package/dist/util/index.d.ts +2 -43
- package/dist/util/index.js +53 -47
- package/dist/{version_parameter-CgEPNuUt.d.ts → version_parameter-BpmuiMQj.d.cts} +46 -47
- package/dist/{version_parameter-DCE9_itC.d.cts → version_parameter-f75NkWiO.d.ts} +46 -47
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -491,17 +491,20 @@ console.log(`Average latency: ${telemetry.latency} ms`)
|
|
|
491
491
|
|
|
492
492
|
### Clock Synchronization
|
|
493
493
|
|
|
494
|
-
The `
|
|
494
|
+
The `ClockNormalizer` utility provides clock synchronization with a given time service:
|
|
495
495
|
|
|
496
496
|
```typescript
|
|
497
|
-
import {
|
|
497
|
+
import { ClockNormalizer } from './util/clock_normalizer'
|
|
498
498
|
|
|
499
|
-
// Get clock skew relative to
|
|
500
|
-
const
|
|
501
|
-
|
|
499
|
+
// Get clock skew relative to a given time server
|
|
500
|
+
const numSamples = 5 // default is 5
|
|
501
|
+
const timeServerUrl = 'https://time.akamai.com/?ms'
|
|
502
|
+
const offset = await ClockNormalizer.calculateSkew(timeServerUrl, numSamples)
|
|
503
|
+
const clockNormalizer = new ClockNormalizer(timeServerUrl, offset, numSamples)
|
|
504
|
+
console.log(`Local clock is ${offset}ms ahead of network time`)
|
|
502
505
|
|
|
503
506
|
// Adjust local timestamps for network synchronization
|
|
504
|
-
const networkTime = Date.now() -
|
|
507
|
+
const networkTime = Date.now() - offset
|
|
505
508
|
```
|
|
506
509
|
|
|
507
510
|
**Features:**
|
|
@@ -364,13 +364,22 @@ declare class ReasonPhrase {
|
|
|
364
364
|
*/
|
|
365
365
|
/**
|
|
366
366
|
* @public
|
|
367
|
-
* Object datagram status types for MOQT objects.
|
|
368
|
-
*
|
|
369
|
-
*
|
|
367
|
+
* Object datagram status types for MOQT objects (Draft-14).
|
|
368
|
+
* Status datagrams use types 0x20-0x21.
|
|
369
|
+
*
|
|
370
|
+
* Type bit layout:
|
|
371
|
+
* - Bit 0: Extensions Present (0 = no, 1 = yes)
|
|
372
|
+
*
|
|
373
|
+
* | Type | Extensions Present | Object ID Present |
|
|
374
|
+
* |------|-------------------|------------------|
|
|
375
|
+
* | 0x20 | No | Yes |
|
|
376
|
+
* | 0x21 | Yes | Yes |
|
|
370
377
|
*/
|
|
371
378
|
declare enum ObjectDatagramStatusType {
|
|
372
|
-
|
|
373
|
-
|
|
379
|
+
/** Status without extensions (0x20) */
|
|
380
|
+
WithoutExtensions = 32,
|
|
381
|
+
/** Status with extensions (0x21) */
|
|
382
|
+
WithExtensions = 33
|
|
374
383
|
}
|
|
375
384
|
/**
|
|
376
385
|
* @public
|
|
@@ -384,16 +393,51 @@ declare namespace ObjectDatagramStatusType {
|
|
|
384
393
|
* @throws Error if the value is not valid.
|
|
385
394
|
*/
|
|
386
395
|
function tryFrom(value: number | bigint): ObjectDatagramStatusType;
|
|
396
|
+
/**
|
|
397
|
+
* Returns true if the type has extensions.
|
|
398
|
+
* @param t - The ObjectDatagramStatusType.
|
|
399
|
+
*/
|
|
400
|
+
function hasExtensions(t: ObjectDatagramStatusType): boolean;
|
|
387
401
|
}
|
|
388
402
|
/**
|
|
389
403
|
* @public
|
|
390
|
-
* Object datagram types for MOQT objects.
|
|
391
|
-
*
|
|
392
|
-
*
|
|
404
|
+
* Object datagram types for MOQT objects (Draft-14).
|
|
405
|
+
*
|
|
406
|
+
* Type bit layout for 0x00-0x07:
|
|
407
|
+
* - Bit 0: Extensions Present (0 = no, 1 = yes)
|
|
408
|
+
* - Bit 1: End of Group (0 = no, 1 = yes)
|
|
409
|
+
* - Bit 2: Object ID Present (0 = Object ID omitted & is 0, 1 = Object ID present)
|
|
410
|
+
*
|
|
411
|
+
* Note: Bit 2 is inverted - when set, Object ID is ABSENT (and assumed 0)
|
|
412
|
+
*
|
|
413
|
+
* | Type | End of Group | Extensions | Object ID Present | Content |
|
|
414
|
+
* |------|-------------|------------|------------------|--------|
|
|
415
|
+
* | 0x00 | No | No | Yes | Payload |
|
|
416
|
+
* | 0x01 | No | Yes | Yes | Payload |
|
|
417
|
+
* | 0x02 | Yes | No | Yes | Payload |
|
|
418
|
+
* | 0x03 | Yes | Yes | Yes | Payload |
|
|
419
|
+
* | 0x04 | No | No | No (ID=0) | Payload |
|
|
420
|
+
* | 0x05 | No | Yes | No (ID=0) | Payload |
|
|
421
|
+
* | 0x06 | Yes | No | No (ID=0) | Payload |
|
|
422
|
+
* | 0x07 | Yes | Yes | No (ID=0) | Payload |
|
|
393
423
|
*/
|
|
394
424
|
declare enum ObjectDatagramType {
|
|
395
|
-
|
|
396
|
-
|
|
425
|
+
/** No End of Group, No Extensions, Object ID Present (0x00) */
|
|
426
|
+
Type0x00 = 0,
|
|
427
|
+
/** No End of Group, With Extensions, Object ID Present (0x01) */
|
|
428
|
+
Type0x01 = 1,
|
|
429
|
+
/** End of Group, No Extensions, Object ID Present (0x02) */
|
|
430
|
+
Type0x02 = 2,
|
|
431
|
+
/** End of Group, With Extensions, Object ID Present (0x03) */
|
|
432
|
+
Type0x03 = 3,
|
|
433
|
+
/** No End of Group, No Extensions, Object ID = 0 (0x04) */
|
|
434
|
+
Type0x04 = 4,
|
|
435
|
+
/** No End of Group, With Extensions, Object ID = 0 (0x05) */
|
|
436
|
+
Type0x05 = 5,
|
|
437
|
+
/** End of Group, No Extensions, Object ID = 0 (0x06) */
|
|
438
|
+
Type0x06 = 6,
|
|
439
|
+
/** End of Group, With Extensions, Object ID = 0 (0x07) */
|
|
440
|
+
Type0x07 = 7
|
|
397
441
|
}
|
|
398
442
|
/**
|
|
399
443
|
* @public
|
|
@@ -407,6 +451,29 @@ declare namespace ObjectDatagramType {
|
|
|
407
451
|
* @throws Error if the value is not valid.
|
|
408
452
|
*/
|
|
409
453
|
function tryFrom(value: number | bigint): ObjectDatagramType;
|
|
454
|
+
/**
|
|
455
|
+
* Returns true if the type has extensions (bit 0 set).
|
|
456
|
+
* @param t - The ObjectDatagramType.
|
|
457
|
+
*/
|
|
458
|
+
function hasExtensions(t: ObjectDatagramType): boolean;
|
|
459
|
+
/**
|
|
460
|
+
* Returns true if the type indicates End of Group (bit 1 set).
|
|
461
|
+
* @param t - The ObjectDatagramType.
|
|
462
|
+
*/
|
|
463
|
+
function isEndOfGroup(t: ObjectDatagramType): boolean;
|
|
464
|
+
/**
|
|
465
|
+
* Returns true if Object ID is present in the wire format.
|
|
466
|
+
* When bit 2 is set (0x04-0x07), Object ID is ABSENT and assumed to be 0.
|
|
467
|
+
* @param t - The ObjectDatagramType.
|
|
468
|
+
*/
|
|
469
|
+
function hasObjectId(t: ObjectDatagramType): boolean;
|
|
470
|
+
/**
|
|
471
|
+
* Determines the appropriate type for given properties.
|
|
472
|
+
* @param hasExtensions - Whether extensions are present.
|
|
473
|
+
* @param endOfGroup - Whether this is the last object in the group.
|
|
474
|
+
* @param objectIdIsZero - Whether the objectId is 0.
|
|
475
|
+
*/
|
|
476
|
+
function fromProperties(hasExtensions: boolean, endOfGroup: boolean, objectIdIsZero: boolean): ObjectDatagramType;
|
|
410
477
|
}
|
|
411
478
|
/**
|
|
412
479
|
* @public
|
|
@@ -539,18 +606,40 @@ declare namespace ObjectStatus {
|
|
|
539
606
|
* limitations under the License.
|
|
540
607
|
*/
|
|
541
608
|
|
|
609
|
+
/**
|
|
610
|
+
* Represents an OBJECT_DATAGRAM message (Draft-14).
|
|
611
|
+
*
|
|
612
|
+
* Type values 0x00-0x07 indicate payload datagrams with varying properties:
|
|
613
|
+
* - Bit 0: Extensions Present
|
|
614
|
+
* - Bit 1: End of Group
|
|
615
|
+
* - Bit 2: Object ID NOT present (when set, Object ID is 0)
|
|
616
|
+
*/
|
|
542
617
|
declare class DatagramObject {
|
|
543
618
|
readonly type: ObjectDatagramType;
|
|
544
619
|
readonly publisherPriority: number;
|
|
545
620
|
readonly extensionHeaders: KeyValuePair[] | null;
|
|
546
621
|
readonly payload: Uint8Array;
|
|
622
|
+
readonly endOfGroup: boolean;
|
|
547
623
|
readonly trackAlias: bigint;
|
|
548
624
|
readonly location: Location;
|
|
549
625
|
private constructor();
|
|
550
626
|
get groupId(): bigint;
|
|
551
627
|
get objectId(): bigint;
|
|
552
|
-
|
|
553
|
-
|
|
628
|
+
/**
|
|
629
|
+
* Create a new DatagramObject with all properties specified.
|
|
630
|
+
* The type is automatically determined based on extensions, endOfGroup, and objectId.
|
|
631
|
+
*/
|
|
632
|
+
static new(trackAlias: bigint, groupId: bigint, objectId: bigint, publisherPriority: number, extensionHeaders: KeyValuePair[] | null, payload: Uint8Array, endOfGroup?: boolean): DatagramObject;
|
|
633
|
+
/**
|
|
634
|
+
* Create a DatagramObject with extensions.
|
|
635
|
+
* @deprecated Use DatagramObject.new() instead for Draft-14 compliance.
|
|
636
|
+
*/
|
|
637
|
+
static newWithExtensions(trackAlias: bigint, groupId: bigint, objectId: bigint, publisherPriority: number, extensionHeaders: KeyValuePair[], payload: Uint8Array, endOfGroup?: boolean): DatagramObject;
|
|
638
|
+
/**
|
|
639
|
+
* Create a DatagramObject without extensions.
|
|
640
|
+
* @deprecated Use DatagramObject.new() instead for Draft-14 compliance.
|
|
641
|
+
*/
|
|
642
|
+
static newWithoutExtensions(trackAlias: bigint, groupId: bigint, objectId: bigint, publisherPriority: number, payload: Uint8Array, endOfGroup?: boolean): DatagramObject;
|
|
554
643
|
serialize(): FrozenByteBuffer;
|
|
555
644
|
static deserialize(buf: BaseByteBuffer): DatagramObject;
|
|
556
645
|
}
|
|
@@ -571,6 +660,16 @@ declare class DatagramObject {
|
|
|
571
660
|
* limitations under the License.
|
|
572
661
|
*/
|
|
573
662
|
|
|
663
|
+
/**
|
|
664
|
+
* Represents an OBJECT_DATAGRAM with status (Draft-14).
|
|
665
|
+
*
|
|
666
|
+
* Type values 0x20-0x21 indicate status datagrams:
|
|
667
|
+
* - 0x20: Without extensions, Object ID present
|
|
668
|
+
* - 0x21: With extensions, Object ID present
|
|
669
|
+
*
|
|
670
|
+
* Status datagrams always have Object ID present (unlike payload datagrams
|
|
671
|
+
* which can omit Object ID when it's 0).
|
|
672
|
+
*/
|
|
574
673
|
declare class DatagramStatus {
|
|
575
674
|
readonly type: ObjectDatagramStatusType;
|
|
576
675
|
readonly publisherPriority: number;
|
|
@@ -581,7 +680,20 @@ declare class DatagramStatus {
|
|
|
581
680
|
private constructor();
|
|
582
681
|
get groupId(): bigint;
|
|
583
682
|
get objectId(): bigint;
|
|
683
|
+
/**
|
|
684
|
+
* Create a new DatagramStatus with all properties specified.
|
|
685
|
+
* The type is automatically determined based on whether extensions are present.
|
|
686
|
+
*/
|
|
687
|
+
static new(trackAlias: bigint | number, location: Location, publisherPriority: number, extensionHeaders: KeyValuePair[] | null, objectStatus: ObjectStatus): DatagramStatus;
|
|
688
|
+
/**
|
|
689
|
+
* Create a DatagramStatus with extensions.
|
|
690
|
+
* @deprecated Use DatagramStatus.new() instead for Draft-14 compliance.
|
|
691
|
+
*/
|
|
584
692
|
static withExtensions(trackAlias: bigint | number, location: Location, publisherPriority: number, extensionHeaders: KeyValuePair[], objectStatus: ObjectStatus): DatagramStatus;
|
|
693
|
+
/**
|
|
694
|
+
* Create a DatagramStatus without extensions.
|
|
695
|
+
* @deprecated Use DatagramStatus.new() instead for Draft-14 compliance.
|
|
696
|
+
*/
|
|
585
697
|
static newWithoutExtensions(trackAlias: bigint | number, location: Location, publisherPriority: number, objectStatus: ObjectStatus): DatagramStatus;
|
|
586
698
|
serialize(): FrozenByteBuffer;
|
|
587
699
|
static deserialize(buf: BaseByteBuffer): DatagramStatus;
|
|
@@ -766,10 +878,21 @@ declare class MoqtObject {
|
|
|
766
878
|
static newWithPayload(fullTrackName: FullTrackName, location: Location, publisherPriority: number, objectForwardingPreference: ObjectForwardingPreference, subgroupId: bigint | number | null, extensionHeaders: KeyValuePair[] | null, payload: Uint8Array): MoqtObject;
|
|
767
879
|
static newWithStatus(fullTrackName: FullTrackName, location: Location, publisherPriority: number, objectForwardingPreference: ObjectForwardingPreference, subgroupId: bigint | number | null, extensionHeaders: KeyValuePair[] | null, objectStatus: ObjectStatus): MoqtObject;
|
|
768
880
|
static fromDatagramObject(datagramObject: DatagramObject, fullTrackName: FullTrackName): MoqtObject;
|
|
881
|
+
/**
|
|
882
|
+
* Returns the endOfGroup flag from the source DatagramObject.
|
|
883
|
+
* This is separate from ObjectStatus.EndOfGroup - the flag indicates
|
|
884
|
+
* this is the last object in the group even with Normal status.
|
|
885
|
+
*/
|
|
886
|
+
static isDatagramEndOfGroup(datagramObject: DatagramObject): boolean;
|
|
769
887
|
static fromDatagramStatus(datagramStatus: DatagramStatus, fullTrackName: FullTrackName): MoqtObject;
|
|
770
888
|
static fromFetchObject(fetchObject: FetchObject, fullTrackName: FullTrackName): MoqtObject;
|
|
771
889
|
static fromSubgroupObject(subgroupObject: SubgroupObject, groupId: bigint | number, publisherPriority: number, subgroupId: bigint | number, fullTrackName: FullTrackName): MoqtObject;
|
|
772
|
-
|
|
890
|
+
/**
|
|
891
|
+
* Convert to DatagramObject for wire transmission.
|
|
892
|
+
* @param trackAlias - The track alias to use
|
|
893
|
+
* @param endOfGroup - Draft-14: Whether this is the last object in the group
|
|
894
|
+
*/
|
|
895
|
+
tryIntoDatagramObject(trackAlias: bigint | number, endOfGroup?: boolean): DatagramObject;
|
|
773
896
|
tryIntoDatagramStatus(trackAlias: bigint | number): DatagramStatus;
|
|
774
897
|
tryIntoFetchObject(): FetchObject;
|
|
775
898
|
tryIntoSubgroupObject(): SubgroupObject;
|
|
@@ -364,13 +364,22 @@ declare class ReasonPhrase {
|
|
|
364
364
|
*/
|
|
365
365
|
/**
|
|
366
366
|
* @public
|
|
367
|
-
* Object datagram status types for MOQT objects.
|
|
368
|
-
*
|
|
369
|
-
*
|
|
367
|
+
* Object datagram status types for MOQT objects (Draft-14).
|
|
368
|
+
* Status datagrams use types 0x20-0x21.
|
|
369
|
+
*
|
|
370
|
+
* Type bit layout:
|
|
371
|
+
* - Bit 0: Extensions Present (0 = no, 1 = yes)
|
|
372
|
+
*
|
|
373
|
+
* | Type | Extensions Present | Object ID Present |
|
|
374
|
+
* |------|-------------------|------------------|
|
|
375
|
+
* | 0x20 | No | Yes |
|
|
376
|
+
* | 0x21 | Yes | Yes |
|
|
370
377
|
*/
|
|
371
378
|
declare enum ObjectDatagramStatusType {
|
|
372
|
-
|
|
373
|
-
|
|
379
|
+
/** Status without extensions (0x20) */
|
|
380
|
+
WithoutExtensions = 32,
|
|
381
|
+
/** Status with extensions (0x21) */
|
|
382
|
+
WithExtensions = 33
|
|
374
383
|
}
|
|
375
384
|
/**
|
|
376
385
|
* @public
|
|
@@ -384,16 +393,51 @@ declare namespace ObjectDatagramStatusType {
|
|
|
384
393
|
* @throws Error if the value is not valid.
|
|
385
394
|
*/
|
|
386
395
|
function tryFrom(value: number | bigint): ObjectDatagramStatusType;
|
|
396
|
+
/**
|
|
397
|
+
* Returns true if the type has extensions.
|
|
398
|
+
* @param t - The ObjectDatagramStatusType.
|
|
399
|
+
*/
|
|
400
|
+
function hasExtensions(t: ObjectDatagramStatusType): boolean;
|
|
387
401
|
}
|
|
388
402
|
/**
|
|
389
403
|
* @public
|
|
390
|
-
* Object datagram types for MOQT objects.
|
|
391
|
-
*
|
|
392
|
-
*
|
|
404
|
+
* Object datagram types for MOQT objects (Draft-14).
|
|
405
|
+
*
|
|
406
|
+
* Type bit layout for 0x00-0x07:
|
|
407
|
+
* - Bit 0: Extensions Present (0 = no, 1 = yes)
|
|
408
|
+
* - Bit 1: End of Group (0 = no, 1 = yes)
|
|
409
|
+
* - Bit 2: Object ID Present (0 = Object ID omitted & is 0, 1 = Object ID present)
|
|
410
|
+
*
|
|
411
|
+
* Note: Bit 2 is inverted - when set, Object ID is ABSENT (and assumed 0)
|
|
412
|
+
*
|
|
413
|
+
* | Type | End of Group | Extensions | Object ID Present | Content |
|
|
414
|
+
* |------|-------------|------------|------------------|--------|
|
|
415
|
+
* | 0x00 | No | No | Yes | Payload |
|
|
416
|
+
* | 0x01 | No | Yes | Yes | Payload |
|
|
417
|
+
* | 0x02 | Yes | No | Yes | Payload |
|
|
418
|
+
* | 0x03 | Yes | Yes | Yes | Payload |
|
|
419
|
+
* | 0x04 | No | No | No (ID=0) | Payload |
|
|
420
|
+
* | 0x05 | No | Yes | No (ID=0) | Payload |
|
|
421
|
+
* | 0x06 | Yes | No | No (ID=0) | Payload |
|
|
422
|
+
* | 0x07 | Yes | Yes | No (ID=0) | Payload |
|
|
393
423
|
*/
|
|
394
424
|
declare enum ObjectDatagramType {
|
|
395
|
-
|
|
396
|
-
|
|
425
|
+
/** No End of Group, No Extensions, Object ID Present (0x00) */
|
|
426
|
+
Type0x00 = 0,
|
|
427
|
+
/** No End of Group, With Extensions, Object ID Present (0x01) */
|
|
428
|
+
Type0x01 = 1,
|
|
429
|
+
/** End of Group, No Extensions, Object ID Present (0x02) */
|
|
430
|
+
Type0x02 = 2,
|
|
431
|
+
/** End of Group, With Extensions, Object ID Present (0x03) */
|
|
432
|
+
Type0x03 = 3,
|
|
433
|
+
/** No End of Group, No Extensions, Object ID = 0 (0x04) */
|
|
434
|
+
Type0x04 = 4,
|
|
435
|
+
/** No End of Group, With Extensions, Object ID = 0 (0x05) */
|
|
436
|
+
Type0x05 = 5,
|
|
437
|
+
/** End of Group, No Extensions, Object ID = 0 (0x06) */
|
|
438
|
+
Type0x06 = 6,
|
|
439
|
+
/** End of Group, With Extensions, Object ID = 0 (0x07) */
|
|
440
|
+
Type0x07 = 7
|
|
397
441
|
}
|
|
398
442
|
/**
|
|
399
443
|
* @public
|
|
@@ -407,6 +451,29 @@ declare namespace ObjectDatagramType {
|
|
|
407
451
|
* @throws Error if the value is not valid.
|
|
408
452
|
*/
|
|
409
453
|
function tryFrom(value: number | bigint): ObjectDatagramType;
|
|
454
|
+
/**
|
|
455
|
+
* Returns true if the type has extensions (bit 0 set).
|
|
456
|
+
* @param t - The ObjectDatagramType.
|
|
457
|
+
*/
|
|
458
|
+
function hasExtensions(t: ObjectDatagramType): boolean;
|
|
459
|
+
/**
|
|
460
|
+
* Returns true if the type indicates End of Group (bit 1 set).
|
|
461
|
+
* @param t - The ObjectDatagramType.
|
|
462
|
+
*/
|
|
463
|
+
function isEndOfGroup(t: ObjectDatagramType): boolean;
|
|
464
|
+
/**
|
|
465
|
+
* Returns true if Object ID is present in the wire format.
|
|
466
|
+
* When bit 2 is set (0x04-0x07), Object ID is ABSENT and assumed to be 0.
|
|
467
|
+
* @param t - The ObjectDatagramType.
|
|
468
|
+
*/
|
|
469
|
+
function hasObjectId(t: ObjectDatagramType): boolean;
|
|
470
|
+
/**
|
|
471
|
+
* Determines the appropriate type for given properties.
|
|
472
|
+
* @param hasExtensions - Whether extensions are present.
|
|
473
|
+
* @param endOfGroup - Whether this is the last object in the group.
|
|
474
|
+
* @param objectIdIsZero - Whether the objectId is 0.
|
|
475
|
+
*/
|
|
476
|
+
function fromProperties(hasExtensions: boolean, endOfGroup: boolean, objectIdIsZero: boolean): ObjectDatagramType;
|
|
410
477
|
}
|
|
411
478
|
/**
|
|
412
479
|
* @public
|
|
@@ -539,18 +606,40 @@ declare namespace ObjectStatus {
|
|
|
539
606
|
* limitations under the License.
|
|
540
607
|
*/
|
|
541
608
|
|
|
609
|
+
/**
|
|
610
|
+
* Represents an OBJECT_DATAGRAM message (Draft-14).
|
|
611
|
+
*
|
|
612
|
+
* Type values 0x00-0x07 indicate payload datagrams with varying properties:
|
|
613
|
+
* - Bit 0: Extensions Present
|
|
614
|
+
* - Bit 1: End of Group
|
|
615
|
+
* - Bit 2: Object ID NOT present (when set, Object ID is 0)
|
|
616
|
+
*/
|
|
542
617
|
declare class DatagramObject {
|
|
543
618
|
readonly type: ObjectDatagramType;
|
|
544
619
|
readonly publisherPriority: number;
|
|
545
620
|
readonly extensionHeaders: KeyValuePair[] | null;
|
|
546
621
|
readonly payload: Uint8Array;
|
|
622
|
+
readonly endOfGroup: boolean;
|
|
547
623
|
readonly trackAlias: bigint;
|
|
548
624
|
readonly location: Location;
|
|
549
625
|
private constructor();
|
|
550
626
|
get groupId(): bigint;
|
|
551
627
|
get objectId(): bigint;
|
|
552
|
-
|
|
553
|
-
|
|
628
|
+
/**
|
|
629
|
+
* Create a new DatagramObject with all properties specified.
|
|
630
|
+
* The type is automatically determined based on extensions, endOfGroup, and objectId.
|
|
631
|
+
*/
|
|
632
|
+
static new(trackAlias: bigint, groupId: bigint, objectId: bigint, publisherPriority: number, extensionHeaders: KeyValuePair[] | null, payload: Uint8Array, endOfGroup?: boolean): DatagramObject;
|
|
633
|
+
/**
|
|
634
|
+
* Create a DatagramObject with extensions.
|
|
635
|
+
* @deprecated Use DatagramObject.new() instead for Draft-14 compliance.
|
|
636
|
+
*/
|
|
637
|
+
static newWithExtensions(trackAlias: bigint, groupId: bigint, objectId: bigint, publisherPriority: number, extensionHeaders: KeyValuePair[], payload: Uint8Array, endOfGroup?: boolean): DatagramObject;
|
|
638
|
+
/**
|
|
639
|
+
* Create a DatagramObject without extensions.
|
|
640
|
+
* @deprecated Use DatagramObject.new() instead for Draft-14 compliance.
|
|
641
|
+
*/
|
|
642
|
+
static newWithoutExtensions(trackAlias: bigint, groupId: bigint, objectId: bigint, publisherPriority: number, payload: Uint8Array, endOfGroup?: boolean): DatagramObject;
|
|
554
643
|
serialize(): FrozenByteBuffer;
|
|
555
644
|
static deserialize(buf: BaseByteBuffer): DatagramObject;
|
|
556
645
|
}
|
|
@@ -571,6 +660,16 @@ declare class DatagramObject {
|
|
|
571
660
|
* limitations under the License.
|
|
572
661
|
*/
|
|
573
662
|
|
|
663
|
+
/**
|
|
664
|
+
* Represents an OBJECT_DATAGRAM with status (Draft-14).
|
|
665
|
+
*
|
|
666
|
+
* Type values 0x20-0x21 indicate status datagrams:
|
|
667
|
+
* - 0x20: Without extensions, Object ID present
|
|
668
|
+
* - 0x21: With extensions, Object ID present
|
|
669
|
+
*
|
|
670
|
+
* Status datagrams always have Object ID present (unlike payload datagrams
|
|
671
|
+
* which can omit Object ID when it's 0).
|
|
672
|
+
*/
|
|
574
673
|
declare class DatagramStatus {
|
|
575
674
|
readonly type: ObjectDatagramStatusType;
|
|
576
675
|
readonly publisherPriority: number;
|
|
@@ -581,7 +680,20 @@ declare class DatagramStatus {
|
|
|
581
680
|
private constructor();
|
|
582
681
|
get groupId(): bigint;
|
|
583
682
|
get objectId(): bigint;
|
|
683
|
+
/**
|
|
684
|
+
* Create a new DatagramStatus with all properties specified.
|
|
685
|
+
* The type is automatically determined based on whether extensions are present.
|
|
686
|
+
*/
|
|
687
|
+
static new(trackAlias: bigint | number, location: Location, publisherPriority: number, extensionHeaders: KeyValuePair[] | null, objectStatus: ObjectStatus): DatagramStatus;
|
|
688
|
+
/**
|
|
689
|
+
* Create a DatagramStatus with extensions.
|
|
690
|
+
* @deprecated Use DatagramStatus.new() instead for Draft-14 compliance.
|
|
691
|
+
*/
|
|
584
692
|
static withExtensions(trackAlias: bigint | number, location: Location, publisherPriority: number, extensionHeaders: KeyValuePair[], objectStatus: ObjectStatus): DatagramStatus;
|
|
693
|
+
/**
|
|
694
|
+
* Create a DatagramStatus without extensions.
|
|
695
|
+
* @deprecated Use DatagramStatus.new() instead for Draft-14 compliance.
|
|
696
|
+
*/
|
|
585
697
|
static newWithoutExtensions(trackAlias: bigint | number, location: Location, publisherPriority: number, objectStatus: ObjectStatus): DatagramStatus;
|
|
586
698
|
serialize(): FrozenByteBuffer;
|
|
587
699
|
static deserialize(buf: BaseByteBuffer): DatagramStatus;
|
|
@@ -766,10 +878,21 @@ declare class MoqtObject {
|
|
|
766
878
|
static newWithPayload(fullTrackName: FullTrackName, location: Location, publisherPriority: number, objectForwardingPreference: ObjectForwardingPreference, subgroupId: bigint | number | null, extensionHeaders: KeyValuePair[] | null, payload: Uint8Array): MoqtObject;
|
|
767
879
|
static newWithStatus(fullTrackName: FullTrackName, location: Location, publisherPriority: number, objectForwardingPreference: ObjectForwardingPreference, subgroupId: bigint | number | null, extensionHeaders: KeyValuePair[] | null, objectStatus: ObjectStatus): MoqtObject;
|
|
768
880
|
static fromDatagramObject(datagramObject: DatagramObject, fullTrackName: FullTrackName): MoqtObject;
|
|
881
|
+
/**
|
|
882
|
+
* Returns the endOfGroup flag from the source DatagramObject.
|
|
883
|
+
* This is separate from ObjectStatus.EndOfGroup - the flag indicates
|
|
884
|
+
* this is the last object in the group even with Normal status.
|
|
885
|
+
*/
|
|
886
|
+
static isDatagramEndOfGroup(datagramObject: DatagramObject): boolean;
|
|
769
887
|
static fromDatagramStatus(datagramStatus: DatagramStatus, fullTrackName: FullTrackName): MoqtObject;
|
|
770
888
|
static fromFetchObject(fetchObject: FetchObject, fullTrackName: FullTrackName): MoqtObject;
|
|
771
889
|
static fromSubgroupObject(subgroupObject: SubgroupObject, groupId: bigint | number, publisherPriority: number, subgroupId: bigint | number, fullTrackName: FullTrackName): MoqtObject;
|
|
772
|
-
|
|
890
|
+
/**
|
|
891
|
+
* Convert to DatagramObject for wire transmission.
|
|
892
|
+
* @param trackAlias - The track alias to use
|
|
893
|
+
* @param endOfGroup - Draft-14: Whether this is the last object in the group
|
|
894
|
+
*/
|
|
895
|
+
tryIntoDatagramObject(trackAlias: bigint | number, endOfGroup?: boolean): DatagramObject;
|
|
773
896
|
tryIntoDatagramStatus(trackAlias: bigint | number): DatagramStatus;
|
|
774
897
|
tryIntoFetchObject(): FetchObject;
|
|
775
898
|
tryIntoSubgroupObject(): SubgroupObject;
|