moqtail 0.7.0 → 0.8.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.
@@ -529,27 +529,37 @@ var ReasonPhrase = class _ReasonPhrase {
529
529
 
530
530
  // src/model/data/constant.ts
531
531
  var ObjectDatagramStatusType = /* @__PURE__ */ ((ObjectDatagramStatusType2) => {
532
- ObjectDatagramStatusType2[ObjectDatagramStatusType2["WithoutExtensions"] = 2] = "WithoutExtensions";
533
- ObjectDatagramStatusType2[ObjectDatagramStatusType2["WithExtensions"] = 3] = "WithExtensions";
532
+ ObjectDatagramStatusType2[ObjectDatagramStatusType2["WithoutExtensions"] = 32] = "WithoutExtensions";
533
+ ObjectDatagramStatusType2[ObjectDatagramStatusType2["WithExtensions"] = 33] = "WithExtensions";
534
534
  return ObjectDatagramStatusType2;
535
535
  })(ObjectDatagramStatusType || {});
536
536
  ((ObjectDatagramStatusType2) => {
537
537
  function tryFrom(value) {
538
538
  const v = typeof value === "bigint" ? Number(value) : value;
539
539
  switch (v) {
540
- case 2:
541
- return 2 /* WithoutExtensions */;
542
- case 3:
543
- return 3 /* WithExtensions */;
540
+ case 32:
541
+ return 32 /* WithoutExtensions */;
542
+ case 33:
543
+ return 33 /* WithExtensions */;
544
544
  default:
545
545
  throw new Error(`Invalid ObjectDatagramStatusType: ${value}`);
546
546
  }
547
547
  }
548
548
  ObjectDatagramStatusType2.tryFrom = tryFrom;
549
+ function hasExtensions(t) {
550
+ return t === 33 /* WithExtensions */;
551
+ }
552
+ ObjectDatagramStatusType2.hasExtensions = hasExtensions;
549
553
  })(ObjectDatagramStatusType || (ObjectDatagramStatusType = {}));
550
554
  var ObjectDatagramType = /* @__PURE__ */ ((ObjectDatagramType2) => {
551
- ObjectDatagramType2[ObjectDatagramType2["WithoutExtensions"] = 0] = "WithoutExtensions";
552
- ObjectDatagramType2[ObjectDatagramType2["WithExtensions"] = 1] = "WithExtensions";
555
+ ObjectDatagramType2[ObjectDatagramType2["Type0x00"] = 0] = "Type0x00";
556
+ ObjectDatagramType2[ObjectDatagramType2["Type0x01"] = 1] = "Type0x01";
557
+ ObjectDatagramType2[ObjectDatagramType2["Type0x02"] = 2] = "Type0x02";
558
+ ObjectDatagramType2[ObjectDatagramType2["Type0x03"] = 3] = "Type0x03";
559
+ ObjectDatagramType2[ObjectDatagramType2["Type0x04"] = 4] = "Type0x04";
560
+ ObjectDatagramType2[ObjectDatagramType2["Type0x05"] = 5] = "Type0x05";
561
+ ObjectDatagramType2[ObjectDatagramType2["Type0x06"] = 6] = "Type0x06";
562
+ ObjectDatagramType2[ObjectDatagramType2["Type0x07"] = 7] = "Type0x07";
553
563
  return ObjectDatagramType2;
554
564
  })(ObjectDatagramType || {});
555
565
  ((ObjectDatagramType2) => {
@@ -557,14 +567,46 @@ var ObjectDatagramType = /* @__PURE__ */ ((ObjectDatagramType2) => {
557
567
  const v = typeof value === "bigint" ? Number(value) : value;
558
568
  switch (v) {
559
569
  case 0:
560
- return 0 /* WithoutExtensions */;
570
+ return 0 /* Type0x00 */;
561
571
  case 1:
562
- return 1 /* WithExtensions */;
572
+ return 1 /* Type0x01 */;
573
+ case 2:
574
+ return 2 /* Type0x02 */;
575
+ case 3:
576
+ return 3 /* Type0x03 */;
577
+ case 4:
578
+ return 4 /* Type0x04 */;
579
+ case 5:
580
+ return 5 /* Type0x05 */;
581
+ case 6:
582
+ return 6 /* Type0x06 */;
583
+ case 7:
584
+ return 7 /* Type0x07 */;
563
585
  default:
564
586
  throw new Error(`Invalid ObjectDatagramType: ${value}`);
565
587
  }
566
588
  }
567
589
  ObjectDatagramType2.tryFrom = tryFrom;
590
+ function hasExtensions(t) {
591
+ return (t & 1) !== 0;
592
+ }
593
+ ObjectDatagramType2.hasExtensions = hasExtensions;
594
+ function isEndOfGroup(t) {
595
+ return (t & 2) !== 0;
596
+ }
597
+ ObjectDatagramType2.isEndOfGroup = isEndOfGroup;
598
+ function hasObjectId(t) {
599
+ return (t & 4) === 0;
600
+ }
601
+ ObjectDatagramType2.hasObjectId = hasObjectId;
602
+ function fromProperties(hasExtensions2, endOfGroup, objectIdIsZero) {
603
+ let type = 0;
604
+ if (hasExtensions2) type |= 1;
605
+ if (endOfGroup) type |= 2;
606
+ if (objectIdIsZero) type |= 4;
607
+ return type;
608
+ }
609
+ ObjectDatagramType2.fromProperties = fromProperties;
568
610
  })(ObjectDatagramType || (ObjectDatagramType = {}));
569
611
  var FetchHeaderType = /* @__PURE__ */ ((FetchHeaderType2) => {
570
612
  FetchHeaderType2[FetchHeaderType2["Type0x05"] = 5] = "Type0x05";
@@ -710,11 +752,12 @@ var ObjectStatus = /* @__PURE__ */ ((ObjectStatus2) => {
710
752
 
711
753
  // src/model/data/datagram_object.ts
712
754
  var DatagramObject = class _DatagramObject {
713
- constructor(type, trackAlias, location, publisherPriority, extensionHeaders, payload) {
755
+ constructor(type, trackAlias, location, publisherPriority, extensionHeaders, payload, endOfGroup) {
714
756
  this.type = type;
715
757
  this.publisherPriority = publisherPriority;
716
758
  this.extensionHeaders = extensionHeaders;
717
759
  this.payload = payload;
760
+ this.endOfGroup = endOfGroup;
718
761
  this.trackAlias = BigInt(trackAlias);
719
762
  this.location = location;
720
763
  }
@@ -726,34 +769,48 @@ var DatagramObject = class _DatagramObject {
726
769
  get objectId() {
727
770
  return this.location.object;
728
771
  }
729
- static newWithExtensions(trackAlias, groupId, objectId, publisherPriority, extensionHeaders, payload) {
772
+ /**
773
+ * Create a new DatagramObject with all properties specified.
774
+ * The type is automatically determined based on extensions, endOfGroup, and objectId.
775
+ */
776
+ static new(trackAlias, groupId, objectId, publisherPriority, extensionHeaders, payload, endOfGroup = false) {
777
+ const hasExtensions = extensionHeaders !== null && extensionHeaders.length > 0;
778
+ const objectIdIsZero = objectId === 0n;
779
+ const type = ObjectDatagramType.fromProperties(hasExtensions, endOfGroup, objectIdIsZero);
730
780
  return new _DatagramObject(
731
- 1 /* WithExtensions */,
781
+ type,
732
782
  trackAlias,
733
783
  new Location(groupId, objectId),
734
784
  publisherPriority,
735
- extensionHeaders,
736
- payload
785
+ hasExtensions ? extensionHeaders : null,
786
+ payload,
787
+ endOfGroup
737
788
  );
738
789
  }
739
- static newWithoutExtensions(trackAlias, groupId, objectId, publisherPriority, payload) {
740
- return new _DatagramObject(
741
- 0 /* WithoutExtensions */,
742
- trackAlias,
743
- new Location(groupId, objectId),
744
- publisherPriority,
745
- null,
746
- payload
747
- );
790
+ /**
791
+ * Create a DatagramObject with extensions.
792
+ * @deprecated Use DatagramObject.new() instead for Draft-14 compliance.
793
+ */
794
+ static newWithExtensions(trackAlias, groupId, objectId, publisherPriority, extensionHeaders, payload, endOfGroup = false) {
795
+ return _DatagramObject.new(trackAlias, groupId, objectId, publisherPriority, extensionHeaders, payload, endOfGroup);
796
+ }
797
+ /**
798
+ * Create a DatagramObject without extensions.
799
+ * @deprecated Use DatagramObject.new() instead for Draft-14 compliance.
800
+ */
801
+ static newWithoutExtensions(trackAlias, groupId, objectId, publisherPriority, payload, endOfGroup = false) {
802
+ return _DatagramObject.new(trackAlias, groupId, objectId, publisherPriority, null, payload, endOfGroup);
748
803
  }
749
804
  serialize() {
750
805
  const buf = new ByteBuffer();
751
806
  buf.putVI(this.type);
752
807
  buf.putVI(this.trackAlias);
753
808
  buf.putVI(this.location.group);
754
- buf.putVI(this.location.object);
809
+ if (ObjectDatagramType.hasObjectId(this.type)) {
810
+ buf.putVI(this.location.object);
811
+ }
755
812
  buf.putU8(this.publisherPriority);
756
- if (this.type === 1 /* WithExtensions */) {
813
+ if (ObjectDatagramType.hasExtensions(this.type)) {
757
814
  const extBuf = new ByteBuffer();
758
815
  if (this.extensionHeaders) {
759
816
  for (const header of this.extensionHeaders) {
@@ -771,28 +828,32 @@ var DatagramObject = class _DatagramObject {
771
828
  const msgType = ObjectDatagramType.tryFrom(msgTypeRaw);
772
829
  const trackAlias = buf.getVI();
773
830
  const groupId = buf.getVI();
774
- const objectId = buf.getVI();
831
+ let objectId;
832
+ if (ObjectDatagramType.hasObjectId(msgType)) {
833
+ objectId = buf.getVI();
834
+ } else {
835
+ objectId = 0n;
836
+ }
775
837
  const publisherPriority = buf.getU8();
776
838
  let extensionHeaders = null;
777
- switch (msgType) {
778
- case 1 /* WithExtensions */: {
779
- const extBytes = buf.getLengthPrefixedBytes();
780
- const headerBytes = new FrozenByteBuffer5(extBytes);
781
- extensionHeaders = [];
782
- while (headerBytes.remaining > 0) {
783
- extensionHeaders.push(headerBytes.getKeyValuePair());
784
- }
785
- break;
839
+ if (ObjectDatagramType.hasExtensions(msgType)) {
840
+ const extBytes = buf.getLengthPrefixedBytes();
841
+ const headerBytes = new FrozenByteBuffer5(extBytes);
842
+ extensionHeaders = [];
843
+ while (headerBytes.remaining > 0) {
844
+ extensionHeaders.push(headerBytes.getKeyValuePair());
786
845
  }
787
846
  }
788
847
  const payload = buf.getBytes(buf.remaining);
848
+ const endOfGroup = ObjectDatagramType.isEndOfGroup(msgType);
789
849
  return new _DatagramObject(
790
850
  msgType,
791
851
  trackAlias,
792
852
  new Location(groupId, objectId),
793
853
  publisherPriority,
794
854
  extensionHeaders,
795
- payload
855
+ payload,
856
+ endOfGroup
796
857
  );
797
858
  }
798
859
  };
@@ -815,25 +876,35 @@ var DatagramStatus = class _DatagramStatus {
815
876
  get objectId() {
816
877
  return this.location.object;
817
878
  }
818
- static withExtensions(trackAlias, location, publisherPriority, extensionHeaders, objectStatus) {
879
+ /**
880
+ * Create a new DatagramStatus with all properties specified.
881
+ * The type is automatically determined based on whether extensions are present.
882
+ */
883
+ static new(trackAlias, location, publisherPriority, extensionHeaders, objectStatus) {
884
+ const hasExtensions = extensionHeaders !== null && extensionHeaders.length > 0;
885
+ const type = hasExtensions ? 33 /* WithExtensions */ : 32 /* WithoutExtensions */;
819
886
  return new _DatagramStatus(
820
- 3 /* WithExtensions */,
887
+ type,
821
888
  trackAlias,
822
889
  location,
823
890
  publisherPriority,
824
- extensionHeaders,
891
+ hasExtensions ? extensionHeaders : null,
825
892
  objectStatus
826
893
  );
827
894
  }
895
+ /**
896
+ * Create a DatagramStatus with extensions.
897
+ * @deprecated Use DatagramStatus.new() instead for Draft-14 compliance.
898
+ */
899
+ static withExtensions(trackAlias, location, publisherPriority, extensionHeaders, objectStatus) {
900
+ return _DatagramStatus.new(trackAlias, location, publisherPriority, extensionHeaders, objectStatus);
901
+ }
902
+ /**
903
+ * Create a DatagramStatus without extensions.
904
+ * @deprecated Use DatagramStatus.new() instead for Draft-14 compliance.
905
+ */
828
906
  static newWithoutExtensions(trackAlias, location, publisherPriority, objectStatus) {
829
- return new _DatagramStatus(
830
- 2 /* WithoutExtensions */,
831
- trackAlias,
832
- location,
833
- publisherPriority,
834
- null,
835
- objectStatus
836
- );
907
+ return _DatagramStatus.new(trackAlias, location, publisherPriority, null, objectStatus);
837
908
  }
838
909
  serialize() {
839
910
  const buf = new ByteBuffer();
@@ -842,7 +913,7 @@ var DatagramStatus = class _DatagramStatus {
842
913
  buf.putVI(this.location.group);
843
914
  buf.putVI(this.location.object);
844
915
  buf.putU8(this.publisherPriority);
845
- if (this.type === 3 /* WithExtensions */) {
916
+ if (ObjectDatagramStatusType.hasExtensions(this.type)) {
846
917
  const extBuf = new ByteBuffer();
847
918
  if (this.extensionHeaders) {
848
919
  for (const header of this.extensionHeaders) {
@@ -863,18 +934,14 @@ var DatagramStatus = class _DatagramStatus {
863
934
  const objectId = buf.getVI();
864
935
  const publisherPriority = buf.getU8();
865
936
  let extensionHeaders = null;
866
- switch (msgType) {
867
- case 3 /* WithExtensions */: {
868
- const extBytes = buf.getLengthPrefixedBytes();
869
- const headerBytes = new FrozenByteBuffer5(extBytes);
870
- extensionHeaders = [];
871
- while (headerBytes.remaining > 0) {
872
- extensionHeaders.push(headerBytes.getKeyValuePair());
873
- }
874
- break;
937
+ if (ObjectDatagramStatusType.hasExtensions(msgType)) {
938
+ const extBytes = buf.getLengthPrefixedBytes();
939
+ const headerBytes = new FrozenByteBuffer5(extBytes);
940
+ extensionHeaders = [];
941
+ while (headerBytes.remaining > 0) {
942
+ extensionHeaders.push(headerBytes.getKeyValuePair());
875
943
  }
876
944
  }
877
- console.log("Came here for trying tryFrom with object status");
878
945
  const objectStatus = ObjectStatus.tryFrom(buf.getVI());
879
946
  return new _DatagramStatus(
880
947
  msgType,
@@ -1475,6 +1542,14 @@ var MoqtObject = class _MoqtObject {
1475
1542
  datagramObject.payload
1476
1543
  );
1477
1544
  }
1545
+ /**
1546
+ * Returns the endOfGroup flag from the source DatagramObject.
1547
+ * This is separate from ObjectStatus.EndOfGroup - the flag indicates
1548
+ * this is the last object in the group even with Normal status.
1549
+ */
1550
+ static isDatagramEndOfGroup(datagramObject) {
1551
+ return datagramObject.endOfGroup;
1552
+ }
1478
1553
  static fromDatagramStatus(datagramStatus, fullTrackName) {
1479
1554
  return new _MoqtObject(
1480
1555
  fullTrackName,
@@ -1511,7 +1586,12 @@ var MoqtObject = class _MoqtObject {
1511
1586
  subgroupObject.payload
1512
1587
  );
1513
1588
  }
1514
- tryIntoDatagramObject(trackAlias) {
1589
+ /**
1590
+ * Convert to DatagramObject for wire transmission.
1591
+ * @param trackAlias - The track alias to use
1592
+ * @param endOfGroup - Draft-14: Whether this is the last object in the group
1593
+ */
1594
+ tryIntoDatagramObject(trackAlias, endOfGroup = false) {
1515
1595
  if (this.objectForwardingPreference !== "Datagram" /* Datagram */) {
1516
1596
  throw new CastingError(
1517
1597
  "MoqtObject.tryIntoDatagramObject",
@@ -1527,24 +1607,15 @@ var MoqtObject = class _MoqtObject {
1527
1607
  );
1528
1608
  }
1529
1609
  const alias = BigInt(trackAlias);
1530
- if (this.extensionHeaders && this.extensionHeaders.length > 0) {
1531
- return DatagramObject.newWithExtensions(
1532
- alias,
1533
- this.groupId,
1534
- this.objectId,
1535
- this.publisherPriority,
1536
- this.extensionHeaders,
1537
- this.payload
1538
- );
1539
- } else {
1540
- return DatagramObject.newWithoutExtensions(
1541
- alias,
1542
- this.groupId,
1543
- this.objectId,
1544
- this.publisherPriority,
1545
- this.payload
1546
- );
1547
- }
1610
+ return DatagramObject.new(
1611
+ alias,
1612
+ this.groupId,
1613
+ this.objectId,
1614
+ this.publisherPriority,
1615
+ this.extensionHeaders,
1616
+ this.payload,
1617
+ endOfGroup
1618
+ );
1548
1619
  }
1549
1620
  tryIntoDatagramStatus(trackAlias) {
1550
1621
  if (this.objectForwardingPreference !== "Datagram" /* Datagram */) {
@@ -3289,10 +3360,9 @@ var PublishDone = class _PublishDone {
3289
3360
 
3290
3361
  // src/model/control/publish.ts
3291
3362
  var Publish = class _Publish {
3292
- constructor(requestId, trackNamespace, trackName, trackAlias, groupOrder, contentExists, largestLocation, forward, parameters) {
3363
+ constructor(requestId, fullTrackName, trackAlias, groupOrder, contentExists, largestLocation, forward, parameters) {
3293
3364
  this.requestId = requestId;
3294
- this.trackNamespace = trackNamespace;
3295
- this.trackName = trackName;
3365
+ this.fullTrackName = fullTrackName;
3296
3366
  this.trackAlias = trackAlias;
3297
3367
  this.groupOrder = groupOrder;
3298
3368
  this.contentExists = contentExists;
@@ -3300,11 +3370,10 @@ var Publish = class _Publish {
3300
3370
  this.forward = forward;
3301
3371
  this.parameters = parameters;
3302
3372
  }
3303
- static new(requestId, trackNamespace, trackName, trackAlias, groupOrder, contentExists, largestLocation, forward, parameters) {
3373
+ static new(requestId, fullTrackName, trackAlias, groupOrder, contentExists, largestLocation, forward, parameters) {
3304
3374
  return new _Publish(
3305
3375
  BigInt(requestId),
3306
- trackNamespace,
3307
- trackName,
3376
+ fullTrackName,
3308
3377
  BigInt(trackAlias),
3309
3378
  groupOrder,
3310
3379
  contentExists,
@@ -3321,9 +3390,7 @@ var Publish = class _Publish {
3321
3390
  buf.putVI(29 /* Publish */);
3322
3391
  const payload = new ByteBuffer();
3323
3392
  payload.putVI(this.requestId);
3324
- payload.putTuple(this.trackNamespace);
3325
- payload.putVI(this.trackName.length);
3326
- payload.putBytes(new TextEncoder().encode(this.trackName));
3393
+ payload.putBytes(this.fullTrackName.serialize().toUint8Array());
3327
3394
  payload.putVI(this.trackAlias);
3328
3395
  payload.putU8(this.groupOrder);
3329
3396
  payload.putU8(this.contentExists);
@@ -3345,10 +3412,7 @@ var Publish = class _Publish {
3345
3412
  }
3346
3413
  static parsePayload(buf) {
3347
3414
  const requestId = buf.getVI();
3348
- const trackNamespace = buf.getTuple();
3349
- const trackNameLength = buf.getVI();
3350
- const trackNameBytes = buf.getBytes(Number(trackNameLength));
3351
- const trackName = new TextDecoder().decode(trackNameBytes);
3415
+ const fullTrackName = buf.getFullTrackName();
3352
3416
  const trackAlias = buf.getVI();
3353
3417
  const groupOrder = buf.getU8();
3354
3418
  const contentExists = buf.getU8();
@@ -3364,8 +3428,7 @@ var Publish = class _Publish {
3364
3428
  }
3365
3429
  return new _Publish(
3366
3430
  requestId,
3367
- trackNamespace,
3368
- trackName,
3431
+ fullTrackName,
3369
3432
  trackAlias,
3370
3433
  groupOrder,
3371
3434
  contentExists,
@@ -483,27 +483,37 @@ var ReasonPhrase = class _ReasonPhrase {
483
483
 
484
484
  // src/model/data/constant.ts
485
485
  var ObjectDatagramStatusType = /* @__PURE__ */ ((ObjectDatagramStatusType2) => {
486
- ObjectDatagramStatusType2[ObjectDatagramStatusType2["WithoutExtensions"] = 2] = "WithoutExtensions";
487
- ObjectDatagramStatusType2[ObjectDatagramStatusType2["WithExtensions"] = 3] = "WithExtensions";
486
+ ObjectDatagramStatusType2[ObjectDatagramStatusType2["WithoutExtensions"] = 32] = "WithoutExtensions";
487
+ ObjectDatagramStatusType2[ObjectDatagramStatusType2["WithExtensions"] = 33] = "WithExtensions";
488
488
  return ObjectDatagramStatusType2;
489
489
  })(ObjectDatagramStatusType || {});
490
490
  ((ObjectDatagramStatusType2) => {
491
491
  function tryFrom(value) {
492
492
  const v = typeof value === "bigint" ? Number(value) : value;
493
493
  switch (v) {
494
- case 2:
495
- return 2 /* WithoutExtensions */;
496
- case 3:
497
- return 3 /* WithExtensions */;
494
+ case 32:
495
+ return 32 /* WithoutExtensions */;
496
+ case 33:
497
+ return 33 /* WithExtensions */;
498
498
  default:
499
499
  throw new Error(`Invalid ObjectDatagramStatusType: ${value}`);
500
500
  }
501
501
  }
502
502
  ObjectDatagramStatusType2.tryFrom = tryFrom;
503
+ function hasExtensions(t) {
504
+ return t === 33 /* WithExtensions */;
505
+ }
506
+ ObjectDatagramStatusType2.hasExtensions = hasExtensions;
503
507
  })(ObjectDatagramStatusType || (ObjectDatagramStatusType = {}));
504
508
  var ObjectDatagramType = /* @__PURE__ */ ((ObjectDatagramType2) => {
505
- ObjectDatagramType2[ObjectDatagramType2["WithoutExtensions"] = 0] = "WithoutExtensions";
506
- ObjectDatagramType2[ObjectDatagramType2["WithExtensions"] = 1] = "WithExtensions";
509
+ ObjectDatagramType2[ObjectDatagramType2["Type0x00"] = 0] = "Type0x00";
510
+ ObjectDatagramType2[ObjectDatagramType2["Type0x01"] = 1] = "Type0x01";
511
+ ObjectDatagramType2[ObjectDatagramType2["Type0x02"] = 2] = "Type0x02";
512
+ ObjectDatagramType2[ObjectDatagramType2["Type0x03"] = 3] = "Type0x03";
513
+ ObjectDatagramType2[ObjectDatagramType2["Type0x04"] = 4] = "Type0x04";
514
+ ObjectDatagramType2[ObjectDatagramType2["Type0x05"] = 5] = "Type0x05";
515
+ ObjectDatagramType2[ObjectDatagramType2["Type0x06"] = 6] = "Type0x06";
516
+ ObjectDatagramType2[ObjectDatagramType2["Type0x07"] = 7] = "Type0x07";
507
517
  return ObjectDatagramType2;
508
518
  })(ObjectDatagramType || {});
509
519
  ((ObjectDatagramType2) => {
@@ -511,14 +521,46 @@ var ObjectDatagramType = /* @__PURE__ */ ((ObjectDatagramType2) => {
511
521
  const v = typeof value === "bigint" ? Number(value) : value;
512
522
  switch (v) {
513
523
  case 0:
514
- return 0 /* WithoutExtensions */;
524
+ return 0 /* Type0x00 */;
515
525
  case 1:
516
- return 1 /* WithExtensions */;
526
+ return 1 /* Type0x01 */;
527
+ case 2:
528
+ return 2 /* Type0x02 */;
529
+ case 3:
530
+ return 3 /* Type0x03 */;
531
+ case 4:
532
+ return 4 /* Type0x04 */;
533
+ case 5:
534
+ return 5 /* Type0x05 */;
535
+ case 6:
536
+ return 6 /* Type0x06 */;
537
+ case 7:
538
+ return 7 /* Type0x07 */;
517
539
  default:
518
540
  throw new Error(`Invalid ObjectDatagramType: ${value}`);
519
541
  }
520
542
  }
521
543
  ObjectDatagramType2.tryFrom = tryFrom;
544
+ function hasExtensions(t) {
545
+ return (t & 1) !== 0;
546
+ }
547
+ ObjectDatagramType2.hasExtensions = hasExtensions;
548
+ function isEndOfGroup(t) {
549
+ return (t & 2) !== 0;
550
+ }
551
+ ObjectDatagramType2.isEndOfGroup = isEndOfGroup;
552
+ function hasObjectId(t) {
553
+ return (t & 4) === 0;
554
+ }
555
+ ObjectDatagramType2.hasObjectId = hasObjectId;
556
+ function fromProperties(hasExtensions2, endOfGroup, objectIdIsZero) {
557
+ let type = 0;
558
+ if (hasExtensions2) type |= 1;
559
+ if (endOfGroup) type |= 2;
560
+ if (objectIdIsZero) type |= 4;
561
+ return type;
562
+ }
563
+ ObjectDatagramType2.fromProperties = fromProperties;
522
564
  })(ObjectDatagramType || (ObjectDatagramType = {}));
523
565
  var FetchHeaderType = /* @__PURE__ */ ((FetchHeaderType2) => {
524
566
  FetchHeaderType2[FetchHeaderType2["Type0x05"] = 5] = "Type0x05";
@@ -1756,43 +1798,6 @@ var ClockNormalizer = class _ClockNormalizer {
1756
1798
  }
1757
1799
  };
1758
1800
 
1759
- // src/util/get_akamai_offset.ts
1760
- var AkamaiOffset = class _AkamaiOffset {
1761
- static _offset = null;
1762
- static _promise = null;
1763
- static async getClockSkew() {
1764
- if (_AkamaiOffset._offset !== null) {
1765
- return _AkamaiOffset._offset;
1766
- }
1767
- if (_AkamaiOffset._promise) {
1768
- return _AkamaiOffset._promise;
1769
- }
1770
- _AkamaiOffset._promise = _AkamaiOffset.ClockSkew().then((offset2) => {
1771
- _AkamaiOffset._offset = offset2;
1772
- return offset2;
1773
- });
1774
- const offset = await _AkamaiOffset._promise;
1775
- return Math.round(offset);
1776
- }
1777
- static async ClockSkew() {
1778
- const akamaiUrl = "https://time.akamai.com?ms";
1779
- performance.clearResourceTimings();
1780
- const response = await fetch(akamaiUrl);
1781
- const text = await response.text();
1782
- const TR = parseFloat(text.trim()) * 1e3;
1783
- const entry = performance.getEntriesByType("resource").find((e) => e.name.includes("time.akamai.com"));
1784
- if (!entry) {
1785
- console.warn("No resource entry found for Akamai time request");
1786
- return 0;
1787
- }
1788
- const T0 = entry.fetchStart + performance.timeOrigin;
1789
- const T1 = entry.responseStart + performance.timeOrigin;
1790
- const offset = (T0 + T1) / 2 - TR;
1791
- return offset;
1792
- }
1793
- };
1794
-
1795
- exports.AkamaiOffset = AkamaiOffset;
1796
1801
  exports.ClockNormalizer = ClockNormalizer;
1797
1802
  exports.NetworkTelemetry = NetworkTelemetry;
1798
1803
  exports.PlayoutBuffer = PlayoutBuffer;
@@ -1,4 +1,4 @@
1
- import { n as MoqtObject } from '../byte_buffer-BOK6VPTF.cjs';
1
+ import { n as MoqtObject } from '../byte_buffer-BM4uNj4n.cjs';
2
2
 
3
3
  /**
4
4
  * Copyright 2025 The MOQtail Authors
@@ -161,45 +161,4 @@ declare class ClockNormalizer {
161
161
  private static takeSingleSample;
162
162
  }
163
163
 
164
- /**
165
- * Copyright 2025 The MOQtail Authors
166
- *
167
- * Licensed under the Apache License, Version 2.0 (the "License");
168
- * you may not use this file except in compliance with the License.
169
- * You may obtain a copy of the License at
170
- *
171
- * http://www.apache.org/licenses/LICENSE-2.0
172
- *
173
- * Unless required by applicable law or agreed to in writing, software
174
- * distributed under the License is distributed on an "AS IS" BASIS,
175
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
176
- * See the License for the specific language governing permissions and
177
- * limitations under the License.
178
- */
179
- /**
180
- * @deprecated This class is deprecated and will be removed in a future version.
181
- * Use ClockNormalizer (see ./clock_normalizer.ts) instead for better time synchronization.
182
- *
183
- * @see {@link ClockNormalizer} - Modern replacement with better accuracy
184
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Performance/now} Performance.now() for basic timing
185
- *
186
- * @example
187
- * ```typescript
188
- * // ❌ Deprecated - Don't use
189
- * const offset = await AkamaiOffset.getClockSkew()
190
- *
191
- * // ✅ Use ClockNormalizer instead
192
- * import { ClockNormalizer } from './clock_normalizer'
193
- * const normalizer = await ClockNormalizer.create()
194
- * const offset = normalizer.getSkew()
195
- * const normalizedTime = normalizer.now()
196
- * ```
197
- */
198
- declare class AkamaiOffset {
199
- private static _offset;
200
- private static _promise;
201
- static getClockSkew(): Promise<number>;
202
- private static ClockSkew;
203
- }
204
-
205
- export { AkamaiOffset, type BufferedObject, type Clock, ClockNormalizer, NetworkTelemetry, PlayoutBuffer, PullPlayoutBuffer };
164
+ export { type BufferedObject, type Clock, ClockNormalizer, NetworkTelemetry, PlayoutBuffer, PullPlayoutBuffer };
@@ -1,4 +1,4 @@
1
- import { n as MoqtObject } from '../byte_buffer-BOK6VPTF.js';
1
+ import { n as MoqtObject } from '../byte_buffer-BM4uNj4n.js';
2
2
 
3
3
  /**
4
4
  * Copyright 2025 The MOQtail Authors
@@ -161,45 +161,4 @@ declare class ClockNormalizer {
161
161
  private static takeSingleSample;
162
162
  }
163
163
 
164
- /**
165
- * Copyright 2025 The MOQtail Authors
166
- *
167
- * Licensed under the Apache License, Version 2.0 (the "License");
168
- * you may not use this file except in compliance with the License.
169
- * You may obtain a copy of the License at
170
- *
171
- * http://www.apache.org/licenses/LICENSE-2.0
172
- *
173
- * Unless required by applicable law or agreed to in writing, software
174
- * distributed under the License is distributed on an "AS IS" BASIS,
175
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
176
- * See the License for the specific language governing permissions and
177
- * limitations under the License.
178
- */
179
- /**
180
- * @deprecated This class is deprecated and will be removed in a future version.
181
- * Use ClockNormalizer (see ./clock_normalizer.ts) instead for better time synchronization.
182
- *
183
- * @see {@link ClockNormalizer} - Modern replacement with better accuracy
184
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Performance/now} Performance.now() for basic timing
185
- *
186
- * @example
187
- * ```typescript
188
- * // ❌ Deprecated - Don't use
189
- * const offset = await AkamaiOffset.getClockSkew()
190
- *
191
- * // ✅ Use ClockNormalizer instead
192
- * import { ClockNormalizer } from './clock_normalizer'
193
- * const normalizer = await ClockNormalizer.create()
194
- * const offset = normalizer.getSkew()
195
- * const normalizedTime = normalizer.now()
196
- * ```
197
- */
198
- declare class AkamaiOffset {
199
- private static _offset;
200
- private static _promise;
201
- static getClockSkew(): Promise<number>;
202
- private static ClockSkew;
203
- }
204
-
205
- export { AkamaiOffset, type BufferedObject, type Clock, ClockNormalizer, NetworkTelemetry, PlayoutBuffer, PullPlayoutBuffer };
164
+ export { type BufferedObject, type Clock, ClockNormalizer, NetworkTelemetry, PlayoutBuffer, PullPlayoutBuffer };