obi-sdk 0.13.3 → 0.14.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.
@@ -0,0 +1,6 @@
1
+ import { O } from "./obi-widget-aa83cfb0.js";
2
+ import "./types-f38a47f6.js";
3
+ export {
4
+ O as ObiWidget
5
+ };
6
+ //# sourceMappingURL=index-01b0e3f3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-01b0e3f3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -747,6 +747,7 @@ class ObiSession {
747
747
  }).with("share_screen", () => {
748
748
  this.emitter.emit("screenShareRequested");
749
749
  }).with("prompt_user", () => {
750
+ console.log("[obi] prompt user received");
750
751
  this.emitter.emit("promptUser");
751
752
  }).with("capture_page_html", () => {
752
753
  this.emitter.emit("capturePageHTML");
@@ -779,6 +780,13 @@ class ObiSession {
779
780
  });
780
781
  });
781
782
  });
783
+ this.room.localParticipant.registerRpcMethod("mic_check", async (data) => {
784
+ if (await this.checkMic()) {
785
+ return "ok";
786
+ } else {
787
+ return "error";
788
+ }
789
+ });
782
790
  }
783
791
  /**
784
792
  * Connect to the LiveKit room.
@@ -854,6 +862,20 @@ class ObiSession {
854
862
  getCurrentState() {
855
863
  return this.currentState;
856
864
  }
865
+ async checkMic() {
866
+ let permissionGranted = false;
867
+ try {
868
+ const permStatus = await navigator.permissions.query({ name: "microphone" });
869
+ permissionGranted = permStatus.state === "granted";
870
+ } catch (error) {
871
+ console.error("[obi] error checking microphone permission:", error);
872
+ }
873
+ if (permissionGranted) {
874
+ await this.shareMic();
875
+ }
876
+ this.emitter.emit("micCheck", permissionGranted);
877
+ return permissionGranted;
878
+ }
857
879
  async requestMicrophone() {
858
880
  try {
859
881
  const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
@@ -21152,7 +21174,7 @@ class ObiWidget extends i$1 {
21152
21174
  this.activeSession = null;
21153
21175
  }
21154
21176
  this.showSessionStartModal = false;
21155
- this.showShareMicModal = true;
21177
+ this.showVoiceGuidanceModal = true;
21156
21178
  this.state = SDKState.LOADING;
21157
21179
  setGlobalContext({ widgetState: this.state.toString() });
21158
21180
  await this.connectObi(sessionToken);
@@ -21514,9 +21536,24 @@ class ObiWidget extends i$1 {
21514
21536
  session.on("micShareRequested", () => {
21515
21537
  this.micShareEnabled = true;
21516
21538
  });
21539
+ session.on("micCheck", (permissionGranted) => {
21540
+ if (permissionGranted) {
21541
+ this.showVoiceGuidanceModal = false;
21542
+ this.showShareMicModal = true;
21543
+ } else {
21544
+ this.showShareMicModal = true;
21545
+ this.showVoiceGuidanceModal = false;
21546
+ }
21547
+ });
21517
21548
  session.on("promptUser", () => {
21518
21549
  this.voiceGuidanceEnabled = true;
21519
21550
  });
21551
+ session.on("micCheck", (permissionGranted) => {
21552
+ if (permissionGranted) {
21553
+ this.showVoiceGuidanceModal = true;
21554
+ this.showShareMicModal = false;
21555
+ }
21556
+ });
21520
21557
  }
21521
21558
  /**
21522
21559
  * Handle session creation failure
@@ -22128,4 +22165,4 @@ export {
22128
22165
  withSentryAsyncHandler as w,
22129
22166
  x
22130
22167
  };
22131
- //# sourceMappingURL=obi-widget-222a1e0d.js.map
22168
+ //# sourceMappingURL=obi-widget-aa83cfb0.js.map