@snapcall/stream-ui 1.11.2 → 1.11.3

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.
@@ -1110,6 +1110,16 @@ const $15ddac3121cc3a5d$export$4a210166cc9cb64b = async (src)=>{
1110
1110
 
1111
1111
 
1112
1112
  const $a2f0e3c29b11c88e$var$log = new (0, $0f65a9eaf4a1e910$export$2e2bcd8739ae039)("StreamerMediasoup");
1113
+ const $a2f0e3c29b11c88e$var$SCREEN_SHARING_SIMULCAST_ENCODINGS = [
1114
+ {
1115
+ dtx: true,
1116
+ maxBitrate: 1500000
1117
+ },
1118
+ {
1119
+ dtx: true,
1120
+ maxBitrate: 6000000
1121
+ }
1122
+ ];
1113
1123
  function $a2f0e3c29b11c88e$var$deviceAutoDetection() {
1114
1124
  try {
1115
1125
  const ua = navigator.userAgent;
@@ -1226,6 +1236,30 @@ class $a2f0e3c29b11c88e$export$2e2bcd8739ae039 {
1226
1236
  if (direction === "send") return await this.createSendTransport(server);
1227
1237
  else return await this.createRecvTransport(server);
1228
1238
  }
1239
+ async produceAudio(transport, track, appData) {
1240
+ const producer = await transport.produce({
1241
+ track: track,
1242
+ codecOptions: {
1243
+ opusStereo: true,
1244
+ opusDtx: true
1245
+ },
1246
+ appData: appData
1247
+ });
1248
+ return producer;
1249
+ }
1250
+ async produceVideo(transport, track, appData) {
1251
+ const encodings = undefined;
1252
+ const codecOptions = {
1253
+ videoGoogleStartBitrate: 1000
1254
+ };
1255
+ const producer = await transport.produce({
1256
+ track: track,
1257
+ encodings: encodings,
1258
+ codecOptions: codecOptions,
1259
+ appData: appData
1260
+ });
1261
+ return producer;
1262
+ }
1229
1263
  }
1230
1264
 
1231
1265
 
@@ -1432,16 +1466,6 @@ const $c31e3fb4360572af$var$WEBCAM_SIMULCAST_ENCODINGS = [
1432
1466
  maxBitrate: 5000000
1433
1467
  }
1434
1468
  ];
1435
- const $c31e3fb4360572af$var$SCREEN_SHARING_SIMULCAST_ENCODINGS = [
1436
- {
1437
- dtx: true,
1438
- maxBitrate: 1500000
1439
- },
1440
- {
1441
- dtx: true,
1442
- maxBitrate: 6000000
1443
- }
1444
- ];
1445
1469
  class $c31e3fb4360572af$var$SnapcallEvent extends CustomEvent {
1446
1470
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
1447
1471
  constructor(name, data){
@@ -1498,7 +1522,6 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
1498
1522
  this.roomId = "";
1499
1523
  this.peerId = "";
1500
1524
  this.webcamProducer = null;
1501
- this.screenshareProducer = null;
1502
1525
  this.customMessages = new Map();
1503
1526
  this.audioRenderers = {};
1504
1527
  this.profile = {};
@@ -1960,7 +1983,7 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
1960
1983
  detail: {}
1961
1984
  });
1962
1985
  this.dispatchEvent(event);
1963
- await this.protoo.request("closeProducer", {
1986
+ if (this.protoo.connected) await this.protoo.request("closeProducer", {
1964
1987
  producerId: producerId
1965
1988
  });
1966
1989
  }
@@ -2103,7 +2126,7 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2103
2126
  this.protooTransport.close();
2104
2127
  this.protoo.close();
2105
2128
  this.micProducer?.close();
2106
- this.screenshareProducer?.close();
2129
+ this.screenshareVideoProducer?.close();
2107
2130
  this.webcamProducer?.close();
2108
2131
  this.consumers.forEach((consumer)=>{
2109
2132
  consumer.mediaSoupConsumer.close();
@@ -2205,7 +2228,7 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2205
2228
  this.consumers.forEach((consumer)=>{
2206
2229
  if (consumer.mediaSoupConsumer.kind === "video") videoCount++;
2207
2230
  });
2208
- if (this.screenshareProducer && !this.screenshareProducer.closed) videoCount++;
2231
+ if (this.screenshareVideoProducer && !this.screenshareVideoProducer.closed) videoCount++;
2209
2232
  let scale = {
2210
2233
  scaleResolutionDownBy: 1
2211
2234
  };
@@ -2437,7 +2460,7 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2437
2460
  async disableVideo() {
2438
2461
  if (!this.webcamProducer) return;
2439
2462
  this.webcamProducer.close();
2440
- await this.protoo.request("closeProducer", {
2463
+ if (this.protoo.connected) await this.protoo.request("closeProducer", {
2441
2464
  producerId: this.webcamProducer.id
2442
2465
  });
2443
2466
  this.webcamProducer = null;
@@ -2449,7 +2472,7 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2449
2472
  async enableScreenshare() {
2450
2473
  if (!this.permissions.find((permission)=>permission === "screen_sharing")) throw new Error("feature not allowed");
2451
2474
  const stream = await this.handleGetUserMediaError("screen", navigator.mediaDevices.getDisplayMedia({
2452
- audio: false,
2475
+ audio: true,
2453
2476
  video: {
2454
2477
  displaySurface: "monitor",
2455
2478
  logicalSurface: true,
@@ -2465,26 +2488,28 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2465
2488
  }
2466
2489
  }));
2467
2490
  if (!stream) return;
2468
- const transport = await this.getTransport("video", "send");
2469
- const track = stream.getVideoTracks()[0];
2470
- const encodings = undefined;
2471
- const codecOptions = {
2472
- videoGoogleStartBitrate: 1000
2473
- };
2474
- let deviceType = "screen";
2475
- this.screenshareProducer = await transport.produce({
2476
- track: track,
2477
- encodings: encodings,
2478
- codecOptions: codecOptions,
2479
- appData: {
2491
+ const deviceType = "screen";
2492
+ const audioTransport = await this.getTransport("audio", "send");
2493
+ const audioTrack = stream.getAudioTracks()[0];
2494
+ if (audioTrack) {
2495
+ this.screenshareAudioProducer = await this.streamerMediasoup?.produceAudio(audioTransport, audioTrack, {
2480
2496
  deviceType: deviceType,
2481
2497
  share: true
2482
- }
2498
+ });
2499
+ this.screenshareVideoProducer?.on("transportclose", ()=>{
2500
+ this.screenshareVideoProducer = undefined;
2501
+ });
2502
+ }
2503
+ const track = stream.getVideoTracks()[0];
2504
+ const videoTransport = await this.getTransport("video", "send");
2505
+ this.screenshareVideoProducer = await this.streamerMediasoup?.produceVideo(videoTransport, track, {
2506
+ deviceType: deviceType,
2507
+ share: true
2483
2508
  });
2484
- this.screenshareProducer.on("transportclose", ()=>{
2485
- this.screenshareProducer = null;
2509
+ this.screenshareVideoProducer?.on("transportclose", ()=>{
2510
+ this.screenshareVideoProducer = undefined;
2486
2511
  });
2487
- this.screenshareProducer.on("trackended", ()=>{
2512
+ this.screenshareVideoProducer?.on("trackended", ()=>{
2488
2513
  this.disableScreenshare().catch(()=>{});
2489
2514
  });
2490
2515
  const event = new $c31e3fb4360572af$var$SnapcallEvent("screenshareEnabled", {
@@ -2493,12 +2518,19 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2493
2518
  this.dispatchEvent(event);
2494
2519
  }
2495
2520
  async disableScreenshare() {
2496
- if (this.screenshareProducer) {
2497
- this.screenshareProducer.close();
2498
- await this.protoo.request("closeProducer", {
2499
- producerId: this.screenshareProducer.id
2521
+ if (this.screenshareVideoProducer) {
2522
+ this.screenshareVideoProducer.close();
2523
+ if (this.protoo.connected) await this.protoo.request("closeProducer", {
2524
+ producerId: this.screenshareVideoProducer.id
2500
2525
  });
2501
- this.screenshareProducer = null;
2526
+ this.screenshareVideoProducer = undefined;
2527
+ }
2528
+ if (this.screenshareAudioProducer) {
2529
+ this.screenshareAudioProducer.close();
2530
+ if (this.protoo.connected) await this.protoo.request("closeProducer", {
2531
+ producerId: this.screenshareAudioProducer.id
2532
+ });
2533
+ this.screenshareAudioProducer = undefined;
2502
2534
  }
2503
2535
  const event = new $c31e3fb4360572af$var$SnapcallEvent("screenshareDisabled", {
2504
2536
  detail: {}
@@ -2582,9 +2614,9 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2582
2614
  } else throw new Error("webcam producer not available yet");
2583
2615
  }
2584
2616
  requestLocalScreenshare(element) {
2585
- if (this.screenshareProducer) {
2617
+ if (this.screenshareVideoProducer) {
2586
2618
  const mediaStream = new MediaStream();
2587
- mediaStream.addTrack(this.screenshareProducer.track);
2619
+ mediaStream.addTrack(this.screenshareVideoProducer.track);
2588
2620
  element.srcObject = mediaStream;
2589
2621
  } else $c31e3fb4360572af$var$log.log("requestLocalScreenshare", "screenshare producer not available yet");
2590
2622
  }
@@ -2710,7 +2742,7 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2710
2742
  getDevicesState() {
2711
2743
  const microphoneEnabled = this.micProducer ? !this.micProducer.closed : false;
2712
2744
  const cameraEnabled = this.webcamProducer ? !this.webcamProducer.closed : false;
2713
- const screenshareEnabled = this.screenshareProducer ? !this.screenshareProducer.closed : false;
2745
+ const screenshareEnabled = this.screenshareVideoProducer ? !this.screenshareVideoProducer.closed : false;
2714
2746
  return {
2715
2747
  microphone: {
2716
2748
  enabled: microphoneEnabled,
@@ -10945,18 +10977,21 @@ const $96999d2514f71e51$export$788cb893d96254c8 = ({ state: state , type: type
10945
10977
 
10946
10978
 
10947
10979
 
10980
+
10948
10981
  const $1c8fc500105e5c78$export$f9d8408fefd786da = ({ state: state , setReady: setReady })=>{
10949
10982
  const QRCodeRef = (0, $3Sbms$useRef)(null);
10950
- const QRCodeContainerRef = (0, $3Sbms$useRef)(null);
10951
- const [QRCodeContainerWidth] = (0, $af23c74942bdcae7$export$2b86bedf890eab8)(QRCodeContainerRef.current);
10983
+ const { options: options } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
10984
+ const [QRCodeContainerRef, { width: QRCodeContainerWidth }] = (0, $af23c74942bdcae7$export$e295b0c537d32d7d)();
10952
10985
  (0, $3Sbms$useEffect)(()=>{
10953
- $3Sbms$toCanvas(QRCodeRef.current, window.location.href, {
10986
+ const url = options.sharedURL || window.location.href;
10987
+ $3Sbms$toCanvas(QRCodeRef.current, url, {
10954
10988
  width: QRCodeContainerWidth > 300 ? 300 : QRCodeContainerWidth,
10955
10989
  errorCorrectionLevel: "Q",
10956
10990
  margin: 0
10957
10991
  });
10958
10992
  }, [
10959
- QRCodeContainerWidth
10993
+ QRCodeContainerWidth,
10994
+ options.sharedURL
10960
10995
  ]);
10961
10996
  return /*#__PURE__*/ (0, $3Sbms$jsx)((0, $c0bb66c3d546ed81$export$2b77a92f1a5ad772), {
10962
10997
  centered: true,
@@ -11554,6 +11589,7 @@ const $db82628e5503d51b$export$53819c0e58f98d49 = (props)=>{
11554
11589
  };
11555
11590
 
11556
11591
 
11592
+
11557
11593
  const $92672d57809ea9d3$var$timerText = (delta)=>{
11558
11594
  const d = [
11559
11595
  Math.floor(delta / 60),
@@ -11562,6 +11598,7 @@ const $92672d57809ea9d3$var$timerText = (delta)=>{
11562
11598
  return d.join(":");
11563
11599
  };
11564
11600
  const $92672d57809ea9d3$export$336a011955157f9a = ()=>{
11601
+ const { options: options } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
11565
11602
  const [startRecordTime, setStartRecordTime] = (0, $3Sbms$useState)(undefined);
11566
11603
  const [timer, setTimer] = (0, $3Sbms$useState)(0);
11567
11604
  const [countdownVisible, setCountdownVisible] = (0, $3Sbms$useState)(false);
@@ -11576,7 +11613,9 @@ const $92672d57809ea9d3$export$336a011955157f9a = ()=>{
11576
11613
  });
11577
11614
  const sendAssetsModalState = (0, $3Sbms$useOverlayTriggerState)({});
11578
11615
  const [flashAnimation, setFlashAnimation] = (0, $3Sbms$useState)(false);
11579
- const menuBarState = (0, $a94f21ef9007b90a$export$bd7b6af6aa16550c)({});
11616
+ const menuBarState = (0, $a94f21ef9007b90a$export$bd7b6af6aa16550c)({
11617
+ photo: options?.recorder?.defaultState !== "video"
11618
+ });
11580
11619
  const exitStreaming = (0, $3Sbms$useCallback)(()=>{
11581
11620
  menuBarState.setStreaming(false);
11582
11621
  setStartRecordTime(undefined);
@@ -11823,7 +11862,7 @@ const $26ed036cbc17809a$var$StreamUI = ({ options: options })=>{
11823
11862
  const streamUIContainerRef = (0, $3Sbms$useRef)(null);
11824
11863
  const videosContainerRef = (0, $3Sbms$useRef)(null);
11825
11864
  const remoteTilesContainerRef = (0, $3Sbms$useRef)(null);
11826
- const [streamState, setStreamState] = (0, $3Sbms$useState)(options.recorder ? "recorder" : "streaming");
11865
+ const [streamState, setStreamState] = (0, $3Sbms$useState)(options.recorder?.enabled ? "recorder" : "streaming");
11827
11866
  const [isQuickConnectPopupVisible, setIsQuickConnectPopupVisible] = (0, $3Sbms$useState)(false);
11828
11867
  const [isSettingsMenuVisible, setIsSettingsMenuVisible] = (0, $3Sbms$useState)(false);
11829
11868
  const [isYoutubePopupVisible, setIsYoutubePopupVisible] = (0, $3Sbms$useState)(false);
@@ -11975,7 +12014,7 @@ const $26ed036cbc17809a$var$StreamUI = ({ options: options })=>{
11975
12014
  setPermissions(event.detail.permissions);
11976
12015
  console.log(event.detail.permissions);
11977
12016
  setSelfPeerId(peerId);
11978
- if (!options.recorder) try {
12017
+ if (!options.recorder?.enabled) try {
11979
12018
  await (0, $15a01b611391c1e7$export$494039379563c94d)(options);
11980
12019
  setUserInteractionTriggered(true);
11981
12020
  } catch (userInteractionError) {
@@ -12498,11 +12537,11 @@ var $e02c50a47b475960$exports = {};
12498
12537
  $e02c50a47b475960$exports = "*, :before, :after {\n box-sizing: border-box;\n border: 0 solid #e5e7eb;\n}\n\n:before, :after {\n --tw-content: \"\";\n}\n\nhtml {\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n font-feature-settings: normal;\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n line-height: 1.5;\n}\n\nbody {\n line-height: inherit;\n margin: 0;\n}\n\nhr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n}\n\nabbr:where([title]) {\n text-decoration: underline dotted;\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\nb, strong {\n font-weight: bolder;\n}\n\ncode, kbd, samp, pre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;\n font-size: 1em;\n}\n\nsmall {\n font-size: 80%;\n}\n\nsub, sup {\n vertical-align: baseline;\n font-size: 75%;\n line-height: 0;\n position: relative;\n}\n\nsub {\n bottom: -.25em;\n}\n\nsup {\n top: -.5em;\n}\n\ntable {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n}\n\nbutton, input, optgroup, select, textarea {\n font-family: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n}\n\nbutton, select {\n text-transform: none;\n}\n\nbutton, [type=\"button\"], [type=\"reset\"], [type=\"submit\"] {\n -webkit-appearance: button;\n background-color: #0000;\n background-image: none;\n}\n\n:-moz-focusring {\n outline: auto;\n}\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\nprogress {\n vertical-align: baseline;\n}\n\n::-webkit-inner-spin-button, ::-webkit-outer-spin-button {\n height: auto;\n}\n\n[type=\"search\"] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n}\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n}\n\nsummary {\n display: list-item;\n}\n\nblockquote, dl, dd, h1, h2, h3, h4, h5, h6, hr, figure, p, pre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol, ul, menu {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\ntextarea {\n resize: vertical;\n}\n\ninput::placeholder, textarea::placeholder {\n opacity: 1;\n color: #9ca3af;\n}\n\nbutton, [role=\"button\"] {\n cursor: pointer;\n}\n\n:disabled {\n cursor: default;\n}\n\nimg, svg, video, canvas, audio, iframe, embed, object {\n vertical-align: middle;\n display: block;\n}\n\nimg, video {\n max-width: 100%;\n height: auto;\n}\n\n[hidden] {\n display: none;\n}\n\n";
12499
12538
 
12500
12539
 
12501
- const $24075a5d702d64b3$var$currentURL = new URL(window.location.href);
12502
- const $24075a5d702d64b3$var$microphoneEnabled = $24075a5d702d64b3$var$currentURL.searchParams.get("microphone-enabled") !== "0";
12503
- const $24075a5d702d64b3$var$cameraEnabled = $24075a5d702d64b3$var$currentURL.searchParams.get("camera-enabled") === "1";
12504
12540
  const $24075a5d702d64b3$var$defaultOptions = {
12505
- recorder: false,
12541
+ recorder: {
12542
+ enabled: false,
12543
+ defaultState: "photo"
12544
+ },
12506
12545
  sharedURL: window.location.href,
12507
12546
  showMenuButton: true,
12508
12547
  settingsShortcuts: [
@@ -12514,11 +12553,11 @@ const $24075a5d702d64b3$var$defaultOptions = {
12514
12553
  controls: {
12515
12554
  microphone: {
12516
12555
  available: true,
12517
- enabled: $24075a5d702d64b3$var$microphoneEnabled
12556
+ enabled: true
12518
12557
  },
12519
12558
  camera: {
12520
12559
  available: true,
12521
- enabled: $24075a5d702d64b3$var$cameraEnabled
12560
+ enabled: false
12522
12561
  },
12523
12562
  screenshare: {
12524
12563
  available: true
package/dist/stream-ui.js CHANGED
@@ -1115,6 +1115,16 @@ const $3575c8a563f2a1da$export$4a210166cc9cb64b = async (src)=>{
1115
1115
 
1116
1116
 
1117
1117
  const $a62e7f17be5cf3a0$var$log = new (0, $d0c6baf97675ab49$export$2e2bcd8739ae039)("StreamerMediasoup");
1118
+ const $a62e7f17be5cf3a0$var$SCREEN_SHARING_SIMULCAST_ENCODINGS = [
1119
+ {
1120
+ dtx: true,
1121
+ maxBitrate: 1500000
1122
+ },
1123
+ {
1124
+ dtx: true,
1125
+ maxBitrate: 6000000
1126
+ }
1127
+ ];
1118
1128
  function $a62e7f17be5cf3a0$var$deviceAutoDetection() {
1119
1129
  try {
1120
1130
  const ua = navigator.userAgent;
@@ -1231,6 +1241,30 @@ class $a62e7f17be5cf3a0$export$2e2bcd8739ae039 {
1231
1241
  if (direction === "send") return await this.createSendTransport(server);
1232
1242
  else return await this.createRecvTransport(server);
1233
1243
  }
1244
+ async produceAudio(transport, track, appData) {
1245
+ const producer = await transport.produce({
1246
+ track: track,
1247
+ codecOptions: {
1248
+ opusStereo: true,
1249
+ opusDtx: true
1250
+ },
1251
+ appData: appData
1252
+ });
1253
+ return producer;
1254
+ }
1255
+ async produceVideo(transport, track, appData) {
1256
+ const encodings = undefined;
1257
+ const codecOptions = {
1258
+ videoGoogleStartBitrate: 1000
1259
+ };
1260
+ const producer = await transport.produce({
1261
+ track: track,
1262
+ encodings: encodings,
1263
+ codecOptions: codecOptions,
1264
+ appData: appData
1265
+ });
1266
+ return producer;
1267
+ }
1234
1268
  }
1235
1269
 
1236
1270
 
@@ -1437,16 +1471,6 @@ const $1dedebd5ff3002eb$var$WEBCAM_SIMULCAST_ENCODINGS = [
1437
1471
  maxBitrate: 5000000
1438
1472
  }
1439
1473
  ];
1440
- const $1dedebd5ff3002eb$var$SCREEN_SHARING_SIMULCAST_ENCODINGS = [
1441
- {
1442
- dtx: true,
1443
- maxBitrate: 1500000
1444
- },
1445
- {
1446
- dtx: true,
1447
- maxBitrate: 6000000
1448
- }
1449
- ];
1450
1474
  class $1dedebd5ff3002eb$var$SnapcallEvent extends CustomEvent {
1451
1475
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
1452
1476
  constructor(name, data){
@@ -1503,7 +1527,6 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
1503
1527
  this.roomId = "";
1504
1528
  this.peerId = "";
1505
1529
  this.webcamProducer = null;
1506
- this.screenshareProducer = null;
1507
1530
  this.customMessages = new Map();
1508
1531
  this.audioRenderers = {};
1509
1532
  this.profile = {};
@@ -1965,7 +1988,7 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
1965
1988
  detail: {}
1966
1989
  });
1967
1990
  this.dispatchEvent(event);
1968
- await this.protoo.request("closeProducer", {
1991
+ if (this.protoo.connected) await this.protoo.request("closeProducer", {
1969
1992
  producerId: producerId
1970
1993
  });
1971
1994
  }
@@ -2108,7 +2131,7 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2108
2131
  this.protooTransport.close();
2109
2132
  this.protoo.close();
2110
2133
  this.micProducer?.close();
2111
- this.screenshareProducer?.close();
2134
+ this.screenshareVideoProducer?.close();
2112
2135
  this.webcamProducer?.close();
2113
2136
  this.consumers.forEach((consumer)=>{
2114
2137
  consumer.mediaSoupConsumer.close();
@@ -2210,7 +2233,7 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2210
2233
  this.consumers.forEach((consumer)=>{
2211
2234
  if (consumer.mediaSoupConsumer.kind === "video") videoCount++;
2212
2235
  });
2213
- if (this.screenshareProducer && !this.screenshareProducer.closed) videoCount++;
2236
+ if (this.screenshareVideoProducer && !this.screenshareVideoProducer.closed) videoCount++;
2214
2237
  let scale = {
2215
2238
  scaleResolutionDownBy: 1
2216
2239
  };
@@ -2442,7 +2465,7 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2442
2465
  async disableVideo() {
2443
2466
  if (!this.webcamProducer) return;
2444
2467
  this.webcamProducer.close();
2445
- await this.protoo.request("closeProducer", {
2468
+ if (this.protoo.connected) await this.protoo.request("closeProducer", {
2446
2469
  producerId: this.webcamProducer.id
2447
2470
  });
2448
2471
  this.webcamProducer = null;
@@ -2454,7 +2477,7 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2454
2477
  async enableScreenshare() {
2455
2478
  if (!this.permissions.find((permission)=>permission === "screen_sharing")) throw new Error("feature not allowed");
2456
2479
  const stream = await this.handleGetUserMediaError("screen", navigator.mediaDevices.getDisplayMedia({
2457
- audio: false,
2480
+ audio: true,
2458
2481
  video: {
2459
2482
  displaySurface: "monitor",
2460
2483
  logicalSurface: true,
@@ -2470,26 +2493,28 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2470
2493
  }
2471
2494
  }));
2472
2495
  if (!stream) return;
2473
- const transport = await this.getTransport("video", "send");
2474
- const track = stream.getVideoTracks()[0];
2475
- const encodings = undefined;
2476
- const codecOptions = {
2477
- videoGoogleStartBitrate: 1000
2478
- };
2479
- let deviceType = "screen";
2480
- this.screenshareProducer = await transport.produce({
2481
- track: track,
2482
- encodings: encodings,
2483
- codecOptions: codecOptions,
2484
- appData: {
2496
+ const deviceType = "screen";
2497
+ const audioTransport = await this.getTransport("audio", "send");
2498
+ const audioTrack = stream.getAudioTracks()[0];
2499
+ if (audioTrack) {
2500
+ this.screenshareAudioProducer = await this.streamerMediasoup?.produceAudio(audioTransport, audioTrack, {
2485
2501
  deviceType: deviceType,
2486
2502
  share: true
2487
- }
2503
+ });
2504
+ this.screenshareVideoProducer?.on("transportclose", ()=>{
2505
+ this.screenshareVideoProducer = undefined;
2506
+ });
2507
+ }
2508
+ const track = stream.getVideoTracks()[0];
2509
+ const videoTransport = await this.getTransport("video", "send");
2510
+ this.screenshareVideoProducer = await this.streamerMediasoup?.produceVideo(videoTransport, track, {
2511
+ deviceType: deviceType,
2512
+ share: true
2488
2513
  });
2489
- this.screenshareProducer.on("transportclose", ()=>{
2490
- this.screenshareProducer = null;
2514
+ this.screenshareVideoProducer?.on("transportclose", ()=>{
2515
+ this.screenshareVideoProducer = undefined;
2491
2516
  });
2492
- this.screenshareProducer.on("trackended", ()=>{
2517
+ this.screenshareVideoProducer?.on("trackended", ()=>{
2493
2518
  this.disableScreenshare().catch(()=>{});
2494
2519
  });
2495
2520
  const event = new $1dedebd5ff3002eb$var$SnapcallEvent("screenshareEnabled", {
@@ -2498,12 +2523,19 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2498
2523
  this.dispatchEvent(event);
2499
2524
  }
2500
2525
  async disableScreenshare() {
2501
- if (this.screenshareProducer) {
2502
- this.screenshareProducer.close();
2503
- await this.protoo.request("closeProducer", {
2504
- producerId: this.screenshareProducer.id
2526
+ if (this.screenshareVideoProducer) {
2527
+ this.screenshareVideoProducer.close();
2528
+ if (this.protoo.connected) await this.protoo.request("closeProducer", {
2529
+ producerId: this.screenshareVideoProducer.id
2505
2530
  });
2506
- this.screenshareProducer = null;
2531
+ this.screenshareVideoProducer = undefined;
2532
+ }
2533
+ if (this.screenshareAudioProducer) {
2534
+ this.screenshareAudioProducer.close();
2535
+ if (this.protoo.connected) await this.protoo.request("closeProducer", {
2536
+ producerId: this.screenshareAudioProducer.id
2537
+ });
2538
+ this.screenshareAudioProducer = undefined;
2507
2539
  }
2508
2540
  const event = new $1dedebd5ff3002eb$var$SnapcallEvent("screenshareDisabled", {
2509
2541
  detail: {}
@@ -2587,9 +2619,9 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2587
2619
  } else throw new Error("webcam producer not available yet");
2588
2620
  }
2589
2621
  requestLocalScreenshare(element) {
2590
- if (this.screenshareProducer) {
2622
+ if (this.screenshareVideoProducer) {
2591
2623
  const mediaStream = new MediaStream();
2592
- mediaStream.addTrack(this.screenshareProducer.track);
2624
+ mediaStream.addTrack(this.screenshareVideoProducer.track);
2593
2625
  element.srcObject = mediaStream;
2594
2626
  } else $1dedebd5ff3002eb$var$log.log("requestLocalScreenshare", "screenshare producer not available yet");
2595
2627
  }
@@ -2715,7 +2747,7 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2715
2747
  getDevicesState() {
2716
2748
  const microphoneEnabled = this.micProducer ? !this.micProducer.closed : false;
2717
2749
  const cameraEnabled = this.webcamProducer ? !this.webcamProducer.closed : false;
2718
- const screenshareEnabled = this.screenshareProducer ? !this.screenshareProducer.closed : false;
2750
+ const screenshareEnabled = this.screenshareVideoProducer ? !this.screenshareVideoProducer.closed : false;
2719
2751
  return {
2720
2752
  microphone: {
2721
2753
  enabled: microphoneEnabled,
@@ -10950,18 +10982,21 @@ const $b46da51ab7ae33e7$export$788cb893d96254c8 = ({ state: state , type: type
10950
10982
 
10951
10983
 
10952
10984
 
10985
+
10953
10986
  const $4dac51e936eb334f$export$f9d8408fefd786da = ({ state: state , setReady: setReady })=>{
10954
10987
  const QRCodeRef = (0, $jQDcL$react.useRef)(null);
10955
- const QRCodeContainerRef = (0, $jQDcL$react.useRef)(null);
10956
- const [QRCodeContainerWidth] = (0, $56e1e7a85d8bf4bb$export$2b86bedf890eab8)(QRCodeContainerRef.current);
10988
+ const { options: options } = (0, $jQDcL$react.useContext)((0, $8b39f32976a7698a$export$2e2bcd8739ae039));
10989
+ const [QRCodeContainerRef, { width: QRCodeContainerWidth }] = (0, $56e1e7a85d8bf4bb$export$e295b0c537d32d7d)();
10957
10990
  (0, $jQDcL$react.useEffect)(()=>{
10958
- $jQDcL$qrcode.toCanvas(QRCodeRef.current, window.location.href, {
10991
+ const url = options.sharedURL || window.location.href;
10992
+ $jQDcL$qrcode.toCanvas(QRCodeRef.current, url, {
10959
10993
  width: QRCodeContainerWidth > 300 ? 300 : QRCodeContainerWidth,
10960
10994
  errorCorrectionLevel: "Q",
10961
10995
  margin: 0
10962
10996
  });
10963
10997
  }, [
10964
- QRCodeContainerWidth
10998
+ QRCodeContainerWidth,
10999
+ options.sharedURL
10965
11000
  ]);
10966
11001
  return /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $48c2553f62767e40$export$2b77a92f1a5ad772), {
10967
11002
  centered: true,
@@ -11559,6 +11594,7 @@ const $47dee8347993fb81$export$53819c0e58f98d49 = (props)=>{
11559
11594
  };
11560
11595
 
11561
11596
 
11597
+
11562
11598
  const $7925c01e7577d264$var$timerText = (delta)=>{
11563
11599
  const d = [
11564
11600
  Math.floor(delta / 60),
@@ -11567,6 +11603,7 @@ const $7925c01e7577d264$var$timerText = (delta)=>{
11567
11603
  return d.join(":");
11568
11604
  };
11569
11605
  const $7925c01e7577d264$export$336a011955157f9a = ()=>{
11606
+ const { options: options } = (0, $jQDcL$react.useContext)((0, $8b39f32976a7698a$export$2e2bcd8739ae039));
11570
11607
  const [startRecordTime, setStartRecordTime] = (0, $jQDcL$react.useState)(undefined);
11571
11608
  const [timer, setTimer] = (0, $jQDcL$react.useState)(0);
11572
11609
  const [countdownVisible, setCountdownVisible] = (0, $jQDcL$react.useState)(false);
@@ -11581,7 +11618,9 @@ const $7925c01e7577d264$export$336a011955157f9a = ()=>{
11581
11618
  });
11582
11619
  const sendAssetsModalState = (0, $jQDcL$reactstately.useOverlayTriggerState)({});
11583
11620
  const [flashAnimation, setFlashAnimation] = (0, $jQDcL$react.useState)(false);
11584
- const menuBarState = (0, $6f223c293b335d40$export$bd7b6af6aa16550c)({});
11621
+ const menuBarState = (0, $6f223c293b335d40$export$bd7b6af6aa16550c)({
11622
+ photo: options?.recorder?.defaultState !== "video"
11623
+ });
11585
11624
  const exitStreaming = (0, $jQDcL$react.useCallback)(()=>{
11586
11625
  menuBarState.setStreaming(false);
11587
11626
  setStartRecordTime(undefined);
@@ -11828,7 +11867,7 @@ const $ee8cb448c2c74888$var$StreamUI = ({ options: options })=>{
11828
11867
  const streamUIContainerRef = (0, $jQDcL$react.useRef)(null);
11829
11868
  const videosContainerRef = (0, $jQDcL$react.useRef)(null);
11830
11869
  const remoteTilesContainerRef = (0, $jQDcL$react.useRef)(null);
11831
- const [streamState, setStreamState] = (0, $jQDcL$react.useState)(options.recorder ? "recorder" : "streaming");
11870
+ const [streamState, setStreamState] = (0, $jQDcL$react.useState)(options.recorder?.enabled ? "recorder" : "streaming");
11832
11871
  const [isQuickConnectPopupVisible, setIsQuickConnectPopupVisible] = (0, $jQDcL$react.useState)(false);
11833
11872
  const [isSettingsMenuVisible, setIsSettingsMenuVisible] = (0, $jQDcL$react.useState)(false);
11834
11873
  const [isYoutubePopupVisible, setIsYoutubePopupVisible] = (0, $jQDcL$react.useState)(false);
@@ -11980,7 +12019,7 @@ const $ee8cb448c2c74888$var$StreamUI = ({ options: options })=>{
11980
12019
  setPermissions(event.detail.permissions);
11981
12020
  console.log(event.detail.permissions);
11982
12021
  setSelfPeerId(peerId);
11983
- if (!options.recorder) try {
12022
+ if (!options.recorder?.enabled) try {
11984
12023
  await (0, $c3d5253d9d597eb5$export$494039379563c94d)(options);
11985
12024
  setUserInteractionTriggered(true);
11986
12025
  } catch (userInteractionError) {
@@ -12503,11 +12542,11 @@ var $9833f4335ab609cd$exports = {};
12503
12542
  $9833f4335ab609cd$exports = "*, :before, :after {\n box-sizing: border-box;\n border: 0 solid #e5e7eb;\n}\n\n:before, :after {\n --tw-content: \"\";\n}\n\nhtml {\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n font-feature-settings: normal;\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n line-height: 1.5;\n}\n\nbody {\n line-height: inherit;\n margin: 0;\n}\n\nhr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n}\n\nabbr:where([title]) {\n text-decoration: underline dotted;\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\nb, strong {\n font-weight: bolder;\n}\n\ncode, kbd, samp, pre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;\n font-size: 1em;\n}\n\nsmall {\n font-size: 80%;\n}\n\nsub, sup {\n vertical-align: baseline;\n font-size: 75%;\n line-height: 0;\n position: relative;\n}\n\nsub {\n bottom: -.25em;\n}\n\nsup {\n top: -.5em;\n}\n\ntable {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n}\n\nbutton, input, optgroup, select, textarea {\n font-family: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n}\n\nbutton, select {\n text-transform: none;\n}\n\nbutton, [type=\"button\"], [type=\"reset\"], [type=\"submit\"] {\n -webkit-appearance: button;\n background-color: #0000;\n background-image: none;\n}\n\n:-moz-focusring {\n outline: auto;\n}\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\nprogress {\n vertical-align: baseline;\n}\n\n::-webkit-inner-spin-button, ::-webkit-outer-spin-button {\n height: auto;\n}\n\n[type=\"search\"] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n}\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n}\n\nsummary {\n display: list-item;\n}\n\nblockquote, dl, dd, h1, h2, h3, h4, h5, h6, hr, figure, p, pre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol, ul, menu {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\ntextarea {\n resize: vertical;\n}\n\ninput::placeholder, textarea::placeholder {\n opacity: 1;\n color: #9ca3af;\n}\n\nbutton, [role=\"button\"] {\n cursor: pointer;\n}\n\n:disabled {\n cursor: default;\n}\n\nimg, svg, video, canvas, audio, iframe, embed, object {\n vertical-align: middle;\n display: block;\n}\n\nimg, video {\n max-width: 100%;\n height: auto;\n}\n\n[hidden] {\n display: none;\n}\n\n";
12504
12543
 
12505
12544
 
12506
- const $e68207026aca356b$var$currentURL = new URL(window.location.href);
12507
- const $e68207026aca356b$var$microphoneEnabled = $e68207026aca356b$var$currentURL.searchParams.get("microphone-enabled") !== "0";
12508
- const $e68207026aca356b$var$cameraEnabled = $e68207026aca356b$var$currentURL.searchParams.get("camera-enabled") === "1";
12509
12545
  const $e68207026aca356b$var$defaultOptions = {
12510
- recorder: false,
12546
+ recorder: {
12547
+ enabled: false,
12548
+ defaultState: "photo"
12549
+ },
12511
12550
  sharedURL: window.location.href,
12512
12551
  showMenuButton: true,
12513
12552
  settingsShortcuts: [
@@ -12519,11 +12558,11 @@ const $e68207026aca356b$var$defaultOptions = {
12519
12558
  controls: {
12520
12559
  microphone: {
12521
12560
  available: true,
12522
- enabled: $e68207026aca356b$var$microphoneEnabled
12561
+ enabled: true
12523
12562
  },
12524
12563
  camera: {
12525
12564
  available: true,
12526
- enabled: $e68207026aca356b$var$cameraEnabled
12565
+ enabled: false
12527
12566
  },
12528
12567
  screenshare: {
12529
12568
  available: true