@stream-io/video-client 0.3.1 → 0.3.2

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.
@@ -2,4 +2,6 @@ export * from './devices';
2
2
  export * from './InputMediaDeviceManager';
3
3
  export * from './InputMediaDeviceManagerState';
4
4
  export * from './CameraManager';
5
+ export * from './CameraManagerState';
5
6
  export * from './MicrophoneManager';
7
+ export * from './MicrophoneManagerState';
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "0.3.1";
1
+ export declare const version = "0.3.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
@@ -2,4 +2,6 @@ export * from './devices';
2
2
  export * from './InputMediaDeviceManager';
3
3
  export * from './InputMediaDeviceManagerState';
4
4
  export * from './CameraManager';
5
+ export * from './CameraManagerState';
5
6
  export * from './MicrophoneManager';
7
+ export * from './MicrophoneManagerState';
@@ -21,14 +21,11 @@ import {
21
21
  import { CallState } from '../store';
22
22
  import { PublishOptions } from '../types';
23
23
  import { isReactNative } from '../helpers/platforms';
24
- import {
25
- removeCodec,
26
- setPreferredCodec,
27
- toggleDtx,
28
- } from '../helpers/sdp-munging';
24
+ import { toggleDtx } from '../helpers/sdp-munging';
29
25
  import { Logger } from '../coordinator/connection/types';
30
26
  import { getLogger } from '../logger';
31
27
  import { Dispatcher } from './Dispatcher';
28
+ import { getOSInfo } from '../client-details';
32
29
 
33
30
  const logger: Logger = getLogger(['Publisher']);
34
31
 
@@ -239,9 +236,17 @@ export class Publisher {
239
236
  ? findOptimalVideoLayers(track, targetResolution)
240
237
  : undefined;
241
238
 
239
+ let preferredCodec = opts.preferredCodec;
240
+ if (!preferredCodec && trackType === TrackType.VIDEO) {
241
+ const isRNAndroid =
242
+ isReactNative() && getOSInfo()?.name.toLowerCase() === 'android';
243
+ if (isRNAndroid) {
244
+ preferredCodec = 'VP8';
245
+ }
246
+ }
242
247
  const codecPreferences = this.getCodecPreferences(
243
248
  trackType,
244
- opts.preferredCodec,
249
+ preferredCodec,
245
250
  );
246
251
 
247
252
  // listen for 'ended' event on the track as it might be ended abruptly
@@ -546,19 +551,6 @@ export class Publisher {
546
551
  private mungeCodecs = (sdp?: string) => {
547
552
  if (sdp) {
548
553
  sdp = toggleDtx(sdp, this.isDtxEnabled);
549
- if (isReactNative()) {
550
- if (this.preferredVideoCodec) {
551
- sdp = setPreferredCodec(sdp, 'video', this.preferredVideoCodec);
552
- }
553
- sdp = setPreferredCodec(
554
- sdp,
555
- 'audio',
556
- this.isRedEnabled ? 'red' : 'opus',
557
- );
558
- if (!this.isRedEnabled) {
559
- sdp = removeCodec(sdp, 'audio', 'red');
560
- }
561
- }
562
554
  }
563
555
  return sdp;
564
556
  };
@@ -1,4 +1,6 @@
1
+ import { getOSInfo } from '../client-details';
1
2
  import { TargetResolution } from '../gen/coordinator';
3
+ import { isReactNative } from '../helpers/platforms';
2
4
 
3
5
  export type OptimalVideoLayer = RTCRtpEncodingParameters & {
4
6
  width: number;
@@ -27,6 +29,8 @@ export const findOptimalVideoLayers = (
27
29
  const settings = videoTrack.getSettings();
28
30
  const { width: w = 0, height: h = 0 } = settings;
29
31
 
32
+ const isRNIos = isReactNative() && getOSInfo()?.name.toLowerCase() === 'ios';
33
+
30
34
  const maxBitrate = getComputedMaxBitrate(targetResolution, w, h);
31
35
  let downscaleFactor = 1;
32
36
  ['f', 'h', 'q'].forEach((rid) => {
@@ -40,10 +44,11 @@ export const findOptimalVideoLayers = (
40
44
  height: Math.round(h / downscaleFactor),
41
45
  maxBitrate: Math.round(maxBitrate / downscaleFactor),
42
46
  scaleResolutionDownBy: downscaleFactor,
47
+ // Simulcast on iOS React-Native requires all encodings to share the same framerate
43
48
  maxFramerate: {
44
49
  f: 30,
45
- h: 25,
46
- q: 20,
50
+ h: isRNIos ? 30 : 25,
51
+ q: isRNIos ? 30 : 20,
47
52
  }[rid],
48
53
  });
49
54
  downscaleFactor *= 2;