@stream-io/video-client 1.44.4 → 1.44.5

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.
@@ -618,6 +618,70 @@ describe('DynascaleManager', () => {
618
618
  });
619
619
  });
620
620
 
621
+ it('audio: should register and unregister watchdog binding', () => {
622
+ const watchdog = dynascaleManager.audioBindingsWatchdog!;
623
+ const registerSpy = vi.spyOn(watchdog, 'register');
624
+ const unregisterSpy = vi.spyOn(watchdog, 'unregister');
625
+
626
+ // @ts-expect-error incomplete data
627
+ call.state.updateOrAddParticipant('session-id', {
628
+ userId: 'user-id',
629
+ sessionId: 'session-id',
630
+ publishedTracks: [],
631
+ });
632
+
633
+ const cleanup = dynascaleManager.bindAudioElement(
634
+ document.createElement('audio'),
635
+ 'session-id',
636
+ 'audioTrack',
637
+ );
638
+
639
+ expect(registerSpy).toHaveBeenCalledWith(
640
+ expect.any(HTMLAudioElement),
641
+ 'session-id',
642
+ 'audioTrack',
643
+ );
644
+
645
+ cleanup?.();
646
+
647
+ expect(unregisterSpy).toHaveBeenCalledWith('session-id', 'audioTrack');
648
+ });
649
+
650
+ it('audio: should warn when binding an already-bound session', () => {
651
+ const watchdog = dynascaleManager.audioBindingsWatchdog!;
652
+ // @ts-expect-error private property
653
+ const warnSpy = vi.spyOn(watchdog.logger, 'warn');
654
+
655
+ // @ts-expect-error incomplete data
656
+ call.state.updateOrAddParticipant('session-id', {
657
+ userId: 'user-id',
658
+ sessionId: 'session-id',
659
+ publishedTracks: [],
660
+ });
661
+
662
+ const audioElement1 = document.createElement('audio');
663
+ const audioElement2 = document.createElement('audio');
664
+
665
+ const cleanup1 = dynascaleManager.bindAudioElement(
666
+ audioElement1,
667
+ 'session-id',
668
+ 'audioTrack',
669
+ );
670
+
671
+ const cleanup2 = dynascaleManager.bindAudioElement(
672
+ audioElement2,
673
+ 'session-id',
674
+ 'audioTrack',
675
+ );
676
+
677
+ expect(warnSpy).toHaveBeenCalledWith(
678
+ expect.stringContaining('Audio element already bound'),
679
+ );
680
+
681
+ cleanup1?.();
682
+ cleanup2?.();
683
+ });
684
+
621
685
  it('video: should unsubscribe when element dimensions are zero', () => {
622
686
  // @ts-expect-error incomplete data
623
687
  call.state.updateOrAddParticipant('session-id', {