@snapcall/stream-ui 1.28.0 → 1.28.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.
@@ -1880,7 +1880,7 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
1880
1880
  }
1881
1881
  async getTransport(kind, direction) {
1882
1882
  if (!this.streamerMediasoup || !this.protoo) throw new Error('streamerMediasoup not initialized');
1883
- let transport = this.mediasoupTransport[`${kind}-${direction}`];
1883
+ let transport = this.mediasoupTransport[direction];
1884
1884
  if (!transport) {
1885
1885
  try {
1886
1886
  const promise = this.streamerMediasoup.createTransport(this.protoo, direction);
@@ -1889,7 +1889,7 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
1889
1889
  kind: kind,
1890
1890
  createPromise: promise
1891
1891
  };
1892
- this.mediasoupTransport[`${kind}-${direction}`] = transport;
1892
+ this.mediasoupTransport[direction] = transport;
1893
1893
  transport.transport = await promise;
1894
1894
  if (transport.transport) this.listenWebRTCTransportStates(transport);
1895
1895
  } catch (err) {
@@ -2497,7 +2497,6 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
2497
2497
  this.webcam.facingMode = config.facingMode;
2498
2498
  } else {
2499
2499
  if (config?.device) this.webcam.device = config.device;
2500
- $c31e3fb4360572af$var$log.warn('enableVideo', 'default deviceId', this.webcam.device?.deviceId);
2501
2500
  optionalParam.deviceId = {
2502
2501
  ideal: this.webcam.device?.deviceId
2503
2502
  };
@@ -3980,6 +3979,7 @@ class $e96d119a19ed0c6c$export$45fabd1ce5e673de {
3980
3979
  this.video.addEventListener('enterpictureinpicture', this.onEnterPictureInPicture.bind(this));
3981
3980
  this.video.addEventListener('leavepictureinpicture', this.onLeavePictureInPicture.bind(this));
3982
3981
  this.tiles = [];
3982
+ this.missingVideoWarnings = {};
3983
3983
  }
3984
3984
  async start() {
3985
3985
  if (this.tiles.length) {
@@ -4010,6 +4010,12 @@ class $e96d119a19ed0c6c$export$45fabd1ce5e673de {
4010
4010
  this.started = false;
4011
4011
  this.video.srcObject = null;
4012
4012
  }
4013
+ warnMissingVideo(tileId) {
4014
+ if (!this.missingVideoWarnings[tileId]) {
4015
+ this.missingVideoWarnings[tileId] = '1';
4016
+ console.warn(`MultiPiP: No video found for peer ${tileId}`);
4017
+ }
4018
+ }
4013
4019
  draw() {
4014
4020
  if (this.ctx && this.started) {
4015
4021
  this.ctx.fillStyle = '#1f1f1f';
@@ -4017,7 +4023,10 @@ class $e96d119a19ed0c6c$export$45fabd1ce5e673de {
4017
4023
  if (this.tiles.length) {
4018
4024
  this.tiles.forEach((tile, index)=>{
4019
4025
  const tileVideo = document.body.querySelectorAll(`[data-peer-id='${tile.id}'] video`)[0];
4020
- if (!tileVideo) return console.warn(`MultiPiP: No video found for peer ${tile.id}`);
4026
+ if (!tileVideo) {
4027
+ this.warnMissingVideo(tile.id);
4028
+ return;
4029
+ }
4021
4030
  const tileRect = this.layout?.tileRects[index];
4022
4031
  if (!tileRect) return;
4023
4032
  this.ctx?.save();
@@ -6352,6 +6361,12 @@ const $580bffc02c115932$export$12201ede76c4c5e1 = ()=>{
6352
6361
  const base64Image = await (0, $c9e496369b59be7a$export$2f377c2162fd02b2).captureVideo(videoElementRef.current);
6353
6362
  try {
6354
6363
  const uploaded = await (0, $c9e496369b59be7a$export$2f377c2162fd02b2).saveCapture(base64Image);
6364
+ await (0, $c9e496369b59be7a$export$2f377c2162fd02b2).createEvents([
6365
+ {
6366
+ filename: uploaded.filename,
6367
+ type: 'image'
6368
+ }
6369
+ ]);
6355
6370
  await (0, $c9e496369b59be7a$export$2f377c2162fd02b2).sendCustomMessageToAll({
6356
6371
  type: 'snapshot',
6357
6372
  imageSrc: uploaded.url
@@ -7125,6 +7140,7 @@ const $0707965973625e01$export$f36e83cafa401ab5 = ({ stream: stream, width: widt
7125
7140
  onSnapshot: ()=>snapshot.trigger({
7126
7141
  videoElementRef: videoElementRef
7127
7142
  }),
7143
+ "data-peer-id": stream.id,
7128
7144
  children: [
7129
7145
  /*#__PURE__*/ (0, $3Sbms$jsx)((0, $7ec04c1818c68245$export$d574f5511ec1d79a), {
7130
7146
  ref: videoElementRef,
package/dist/stream-ui.js CHANGED
@@ -1886,7 +1886,7 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
1886
1886
  }
1887
1887
  async getTransport(kind, direction) {
1888
1888
  if (!this.streamerMediasoup || !this.protoo) throw new Error('streamerMediasoup not initialized');
1889
- let transport = this.mediasoupTransport[`${kind}-${direction}`];
1889
+ let transport = this.mediasoupTransport[direction];
1890
1890
  if (!transport) {
1891
1891
  try {
1892
1892
  const promise = this.streamerMediasoup.createTransport(this.protoo, direction);
@@ -1895,7 +1895,7 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
1895
1895
  kind: kind,
1896
1896
  createPromise: promise
1897
1897
  };
1898
- this.mediasoupTransport[`${kind}-${direction}`] = transport;
1898
+ this.mediasoupTransport[direction] = transport;
1899
1899
  transport.transport = await promise;
1900
1900
  if (transport.transport) this.listenWebRTCTransportStates(transport);
1901
1901
  } catch (err) {
@@ -2503,7 +2503,6 @@ class $1dedebd5ff3002eb$export$2e2bcd8739ae039 extends $1dedebd5ff3002eb$var$Str
2503
2503
  this.webcam.facingMode = config.facingMode;
2504
2504
  } else {
2505
2505
  if (config?.device) this.webcam.device = config.device;
2506
- $1dedebd5ff3002eb$var$log.warn('enableVideo', 'default deviceId', this.webcam.device?.deviceId);
2507
2506
  optionalParam.deviceId = {
2508
2507
  ideal: this.webcam.device?.deviceId
2509
2508
  };
@@ -3986,6 +3985,7 @@ class $21395e477f83709c$export$45fabd1ce5e673de {
3986
3985
  this.video.addEventListener('enterpictureinpicture', this.onEnterPictureInPicture.bind(this));
3987
3986
  this.video.addEventListener('leavepictureinpicture', this.onLeavePictureInPicture.bind(this));
3988
3987
  this.tiles = [];
3988
+ this.missingVideoWarnings = {};
3989
3989
  }
3990
3990
  async start() {
3991
3991
  if (this.tiles.length) {
@@ -4016,6 +4016,12 @@ class $21395e477f83709c$export$45fabd1ce5e673de {
4016
4016
  this.started = false;
4017
4017
  this.video.srcObject = null;
4018
4018
  }
4019
+ warnMissingVideo(tileId) {
4020
+ if (!this.missingVideoWarnings[tileId]) {
4021
+ this.missingVideoWarnings[tileId] = '1';
4022
+ console.warn(`MultiPiP: No video found for peer ${tileId}`);
4023
+ }
4024
+ }
4019
4025
  draw() {
4020
4026
  if (this.ctx && this.started) {
4021
4027
  this.ctx.fillStyle = '#1f1f1f';
@@ -4023,7 +4029,10 @@ class $21395e477f83709c$export$45fabd1ce5e673de {
4023
4029
  if (this.tiles.length) {
4024
4030
  this.tiles.forEach((tile, index)=>{
4025
4031
  const tileVideo = document.body.querySelectorAll(`[data-peer-id='${tile.id}'] video`)[0];
4026
- if (!tileVideo) return console.warn(`MultiPiP: No video found for peer ${tile.id}`);
4032
+ if (!tileVideo) {
4033
+ this.warnMissingVideo(tile.id);
4034
+ return;
4035
+ }
4027
4036
  const tileRect = this.layout?.tileRects[index];
4028
4037
  if (!tileRect) return;
4029
4038
  this.ctx?.save();
@@ -6358,6 +6367,12 @@ const $b7b8f2e5b7552341$export$12201ede76c4c5e1 = ()=>{
6358
6367
  const base64Image = await (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).captureVideo(videoElementRef.current);
6359
6368
  try {
6360
6369
  const uploaded = await (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).saveCapture(base64Image);
6370
+ await (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).createEvents([
6371
+ {
6372
+ filename: uploaded.filename,
6373
+ type: 'image'
6374
+ }
6375
+ ]);
6361
6376
  await (0, $c48c1ecc38fed4e9$export$2f377c2162fd02b2).sendCustomMessageToAll({
6362
6377
  type: 'snapshot',
6363
6378
  imageSrc: uploaded.url
@@ -7131,6 +7146,7 @@ const $75b49da54f729405$export$f36e83cafa401ab5 = ({ stream: stream, width: widt
7131
7146
  onSnapshot: ()=>snapshot.trigger({
7132
7147
  videoElementRef: videoElementRef
7133
7148
  }),
7149
+ "data-peer-id": stream.id,
7134
7150
  children: [
7135
7151
  /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $66c45b20958474ec$export$d574f5511ec1d79a), {
7136
7152
  ref: videoElementRef,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcall/stream-ui",
3
- "version": "1.28.0",
3
+ "version": "1.28.1",
4
4
  "description": "",
5
5
  "source": "src/index.tsx",
6
6
  "main": "dist/stream-ui.js",