@stream-io/video-client 0.3.21 → 0.3.23

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/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "0.3.21";
1
+ export declare const version = "0.3.23";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "0.3.21",
3
+ "version": "0.3.23",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
@@ -48,7 +48,6 @@
48
48
  "@rollup/plugin-replace": "^5.0.2",
49
49
  "@rollup/plugin-typescript": "^11.1.2",
50
50
  "@types/jsonwebtoken": "^9.0.1",
51
- "@types/rimraf": "^3.0.2",
52
51
  "@types/sdp-transform": "^2.4.6",
53
52
  "@types/ua-parser-js": "^0.7.36",
54
53
  "@types/ws": "^8.5.4",
@@ -56,7 +55,7 @@
56
55
  "dotenv": "^16.3.1",
57
56
  "happy-dom": "^11.0.2",
58
57
  "prettier": "^2.8.4",
59
- "rimraf": "^3.0.2",
58
+ "rimraf": "^5.0.1",
60
59
  "rollup": "^3.28.1",
61
60
  "typescript": "^4.9.5",
62
61
  "vite": "^4.4.9",
@@ -22,6 +22,7 @@ import {
22
22
  import { ViewportTracker } from './ViewportTracker';
23
23
  import { getLogger } from '../logger';
24
24
  import { getSdkInfo } from '../client-details';
25
+ import { isFirefox, isSafari } from './browsers';
25
26
 
26
27
  const DEFAULT_VIEWPORT_VISIBILITY_STATE: Record<
27
28
  VideoTrackType,
@@ -274,6 +275,14 @@ export class DynascaleManager {
274
275
  }
275
276
  });
276
277
 
278
+ videoElement.autoplay = true;
279
+ videoElement.playsInline = true;
280
+
281
+ // explicitly marking the element as muted will allow autoplay to work
282
+ // without prior user interaction:
283
+ // https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
284
+ videoElement.muted = true;
285
+
277
286
  const streamSubscription = participant$
278
287
  .pipe(
279
288
  distinctUntilKeyChanged(
@@ -284,22 +293,19 @@ export class DynascaleManager {
284
293
  const source =
285
294
  trackType === 'videoTrack' ? p.videoStream : p.screenShareStream;
286
295
  if (videoElement.srcObject === source) return;
287
- setTimeout(() => {
288
- videoElement.srcObject = source ?? null;
289
- if (videoElement.srcObject) {
296
+ videoElement.srcObject = source ?? null;
297
+ if (isSafari() || isFirefox()) {
298
+ setTimeout(() => {
299
+ videoElement.srcObject = source ?? null;
290
300
  videoElement.play().catch((e) => {
291
301
  this.logger('warn', `Failed to play stream`, e);
292
302
  });
293
- }
294
- }, 0);
303
+ // we add extra delay until we attempt to force-play
304
+ // the participant's media stream in Firefox and Safari,
305
+ // as they seem to have some timing issues
306
+ }, 25);
307
+ }
295
308
  });
296
- videoElement.playsInline = true;
297
- videoElement.autoplay = true;
298
-
299
- // explicitly marking the element as muted will allow autoplay to work
300
- // without prior user interaction:
301
- // https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
302
- videoElement.muted = true;
303
309
 
304
310
  return () => {
305
311
  requestTrackWithDimensions(DebounceType.FAST, undefined);
@@ -359,7 +365,8 @@ export class DynascaleManager {
359
365
  getSdkInfo()?.type === SdkType.REACT
360
366
  ? p?.audioOutputDeviceId
361
367
  : selectedDevice;
362
- if ('setSinkId' in audioElement) {
368
+
369
+ if ('setSinkId' in audioElement && typeof deviceId === 'string') {
363
370
  // @ts-expect-error setSinkId is not yet in the lib
364
371
  audioElement.setSinkId(deviceId);
365
372
  }