@camera.ui/browser 0.1.16 → 0.1.17

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.
package/dist/index.d.ts CHANGED
@@ -217,6 +217,7 @@ export declare interface CameraStream {
217
217
  readonly unsupported: Ref<boolean>;
218
218
  readonly hasAudio: Ref<boolean>;
219
219
  readonly hasBackchannel: Ref<boolean>;
220
+ readonly hasMicrophone: Ref<boolean>;
220
221
  readonly error: Ref<Error | undefined>;
221
222
  readonly isReconnecting: Ref<boolean>;
222
223
  readonly activityMode: Ref<CameraActivityMode>;
@@ -648,6 +649,10 @@ export declare class NamespaceManager {
648
649
  return `plugin.${pluginId}.fileserve.rpc`;
649
650
  }
650
651
 
652
+ static pluginPipeRpc(pluginId: string): string {
653
+ return `plugin.${pluginId}.pipe.rpc`;
654
+ }
655
+
651
656
  static cameraNamespaces(cameraId: string): CameraNamespaces {
652
657
  return {
653
658
  cameraSubject: `camera.${cameraId}.subscriber`,
@@ -1134,6 +1139,7 @@ export declare interface ReactiveStream {
1134
1139
  readonly hasVideo: Ref<boolean>;
1135
1140
  readonly hasAudio: Ref<boolean>;
1136
1141
  readonly hasBackchannel: Ref<boolean>;
1142
+ readonly hasMicrophone?: Readonly<Ref<boolean>>;
1137
1143
  readonly isPlaying: Ref<boolean>;
1138
1144
  readonly stalled?: Ref<boolean>;
1139
1145
  readonly connectionPath?: Readonly<Ref<StreamConnectionPath | undefined>>;
package/dist/index.js CHANGED
@@ -160,6 +160,9 @@ var NamespaceManager = class {
160
160
  static pluginFileServeRpc(pluginId) {
161
161
  return `plugin.${pluginId}.fileserve.rpc`;
162
162
  }
163
+ static pluginPipeRpc(pluginId) {
164
+ return `plugin.${pluginId}.pipe.rpc`;
165
+ }
163
166
  static cameraNamespaces(cameraId) {
164
167
  return {
165
168
  cameraSubject: `camera.${cameraId}.subscriber`,
@@ -4657,6 +4660,7 @@ var StreamConnection = class {
4657
4660
  hasVideo;
4658
4661
  hasAudio;
4659
4662
  hasBackchannel;
4663
+ hasMicrophone;
4660
4664
  isPlaying;
4661
4665
  stalled;
4662
4666
  connectionPath;
@@ -4688,6 +4692,7 @@ var StreamConnection = class {
4688
4692
  hiddenPauseRan = false;
4689
4693
  disarmPipWatch = null;
4690
4694
  wsHandle;
4695
+ streamRequested = false;
4691
4696
  wsOpenedAt = 0;
4692
4697
  webrtcHandler;
4693
4698
  mseHandler;
@@ -4697,7 +4702,7 @@ var StreamConnection = class {
4697
4702
  cancelFirstFrameWatch;
4698
4703
  awaitingWebRTCFrame = false;
4699
4704
  backchannelHandler;
4700
- pendingMicTrack = null;
4705
+ micTrack = shallowRef(null);
4701
4706
  offerPeer;
4702
4707
  answeredPeer;
4703
4708
  lastMediaStream = null;
@@ -4750,6 +4755,7 @@ var StreamConnection = class {
4750
4755
  this.hasVideo = ref(false);
4751
4756
  this.hasAudio = ref(false);
4752
4757
  this.hasBackchannel = ref(false);
4758
+ this.hasMicrophone = computed(() => this.micTrack.value !== null);
4753
4759
  this.isPlaying = ref(false);
4754
4760
  this.stalled = ref(false);
4755
4761
  this.webrtcUnreachable = ref(false);
@@ -4966,7 +4972,7 @@ var StreamConnection = class {
4966
4972
  await this.start();
4967
4973
  return;
4968
4974
  }
4969
- if (this.status.value === "connected") await this.restart();
4975
+ if (this.status.value === "connected" || this.streamRequested) await this.restart();
4970
4976
  }
4971
4977
  async setResolution(resolution) {
4972
4978
  if (this.requestedResolution.value === resolution) return;
@@ -4982,7 +4988,7 @@ var StreamConnection = class {
4982
4988
  this.activeResolution.value = result.effectiveResolution;
4983
4989
  this.degradedFrom.value = result.degradedFrom;
4984
4990
  this.degradeReason.value = result.degradedFrom ? "codec" : null;
4985
- if (this.status.value === "connected") await this.restart();
4991
+ if (this.status.value === "connected" || this.wsHandle) await this.restart();
4986
4992
  }
4987
4993
  }
4988
4994
  async setMicrophone(track) {
@@ -4991,7 +4997,7 @@ var StreamConnection = class {
4991
4997
  return;
4992
4998
  }
4993
4999
  if (!this.hasBackchannel.value) return;
4994
- this.pendingMicTrack = track;
5000
+ this.micTrack.value = track;
4995
5001
  if (!this.backchannelHandler) await this.startBackchannel();
4996
5002
  else if (this.backchannelHandler.isConnected) await this.backchannelHandler.setMicrophoneTrack(track);
4997
5003
  }
@@ -5046,7 +5052,7 @@ var StreamConnection = class {
5046
5052
  this.scope.stop();
5047
5053
  }
5048
5054
  restart() {
5049
- return this.reconnect(1e3);
5055
+ return this.reconnect(0);
5050
5056
  }
5051
5057
  invalidateProbe() {
5052
5058
  this.probeInfo.value = void 0;
@@ -5101,7 +5107,7 @@ var StreamConnection = class {
5101
5107
  }
5102
5108
  retryAfterNoMedia() {
5103
5109
  if (this.markSourceUndecodable()) {
5104
- this.restart();
5110
+ this.reconnect(RETRY_BASE_DELAY);
5105
5111
  return;
5106
5112
  }
5107
5113
  this.retryLater(this.lastError);
@@ -5423,6 +5429,7 @@ var StreamConnection = class {
5423
5429
  }
5424
5430
  disconnectWebSocket() {
5425
5431
  this.stopWsConnectTimeout();
5432
+ this.streamRequested = false;
5426
5433
  if (this.wsHandle) {
5427
5434
  this.wsHandle.dispose();
5428
5435
  this.wsHandle = void 0;
@@ -5442,6 +5449,7 @@ var StreamConnection = class {
5442
5449
  });
5443
5450
  }
5444
5451
  requestStream() {
5452
+ this.streamRequested = true;
5445
5453
  if (this.sourceIsMjpeg()) {
5446
5454
  this.startMjpeg();
5447
5455
  return;
@@ -5737,7 +5745,7 @@ var StreamConnection = class {
5737
5745
  if ((phase === "setup" || beforeFirstFrame) && this.sourceLikelyH265()) {
5738
5746
  reportH265DecodeFailure("mse");
5739
5747
  this.markSourceUndecodable();
5740
- this.restart();
5748
+ this.reconnect(RETRY_BASE_DELAY);
5741
5749
  return;
5742
5750
  }
5743
5751
  if (phase === "setup") {
@@ -5956,7 +5964,7 @@ var StreamConnection = class {
5956
5964
  value: candidate
5957
5965
  }),
5958
5966
  onConnected: async () => {
5959
- if (this.pendingMicTrack && this.backchannelHandler === handler) await handler.setMicrophoneTrack(this.pendingMicTrack);
5967
+ if (this.micTrack.value && this.backchannelHandler === handler) await handler.setMicrophoneTrack(this.micTrack.value);
5960
5968
  },
5961
5969
  onFailed: () => this.closeBackchannel(handler)
5962
5970
  });
@@ -5971,7 +5979,7 @@ var StreamConnection = class {
5971
5979
  if (offer && !this.abortController.signal.aborted && this.backchannelHandler === handler) this.sendOffer(handler, offer);
5972
5980
  }
5973
5981
  resumeBackchannel() {
5974
- if (this.pendingMicTrack && !this.backchannelHandler) this.startBackchannel();
5982
+ if (this.micTrack.value && !this.backchannelHandler) this.startBackchannel();
5975
5983
  }
5976
5984
  sendOffer(peer, sdp) {
5977
5985
  if (this.wsHandle?.readyState !== WebSocket.OPEN) return;
@@ -5993,7 +6001,7 @@ var StreamConnection = class {
5993
6001
  handler?.close();
5994
6002
  if (handler !== this.backchannelHandler) return;
5995
6003
  this.backchannelHandler = void 0;
5996
- this.pendingMicTrack = null;
6004
+ this.micTrack.value = null;
5997
6005
  }
5998
6006
  };
5999
6007
  function createStreamConnection(options) {
@@ -6401,6 +6409,7 @@ function useCameraStream(options) {
6401
6409
  const unsupported = computed(() => status.value === "unsupported");
6402
6410
  const hasAudio = computed(() => currentStream.value?.hasAudio.value ?? false);
6403
6411
  const hasBackchannel = computed(() => currentStream.value?.hasBackchannel.value ?? false);
6412
+ const hasMicrophone = computed(() => currentStream.value?.hasMicrophone?.value ?? false);
6404
6413
  const error = computed(() => currentStream.value?.error.value);
6405
6414
  const isReconnecting = computed(() => status.value === "reconnecting");
6406
6415
  const isBusy = computed(() => cameraDeviceLoading.value || !isPlaying.value && status.value !== "error" && status.value !== "unsupported");
@@ -6954,6 +6963,7 @@ function useCameraStream(options) {
6954
6963
  unsupported,
6955
6964
  hasAudio,
6956
6965
  hasBackchannel,
6966
+ hasMicrophone,
6957
6967
  error,
6958
6968
  isReconnecting,
6959
6969
  activityMode: activityModeManager.mode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/browser",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/cameraui/clients)",
6
6
  "type": "module",
@@ -38,12 +38,12 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@camera.ui/logger": "file:../../packages/logger",
41
- "@camera.ui/rpc": "^1.1.2",
42
- "@camera.ui/sdk": "~1.4.9",
41
+ "@camera.ui/rpc": "^1.1.3",
42
+ "@camera.ui/sdk": "~1.4.11",
43
43
  "@camera.ui/transport": "file:../../packages/transport",
44
44
  "@eneris/push-receiver": "^4.4.0",
45
45
  "@microsoft/api-extractor": "^7.60.1",
46
- "@stylistic/eslint-plugin": "^5.10.0",
46
+ "@stylistic/eslint-plugin": "^6.0.0",
47
47
  "@types/webrtc": "^0.0.47",
48
48
  "@typescript-eslint/parser": "^8.72.2",
49
49
  "@vitejs/plugin-vue": "^6.0.11",