@livedigital/client 2.37.3 → 2.37.4-ya-browser-support.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.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@livedigital/client",
3
3
  "author": "vlprojects",
4
4
  "license": "MIT",
5
- "version": "2.37.3",
5
+ "version": "2.37.4-ya-browser-support.2",
6
6
  "private": false,
7
7
  "bugs": {
8
8
  "url": "https://github.com/vlprojects/livedigital-sdk/issues"
@@ -43,6 +43,7 @@
43
43
  "async-mutex": "^0.3.2",
44
44
  "awaitqueue": "^2.4.0",
45
45
  "axios": "^0.21.4",
46
+ "bowser": "^2.11.0",
46
47
  "debug": "^4.3.4",
47
48
  "mediasoup-client": "^3.6.50",
48
49
  "qs": "^6.11.0",
@@ -18,6 +18,7 @@ import { CreateMediaParams } from '../../types/engine';
18
18
  import Engine from '../index';
19
19
  import EnhancedEventEmitter from '../../EnhancedEventEmitter';
20
20
  import MediaStreamTrackManager from './tracks/MediaStreamTrackManager';
21
+ import { detectHandlerName } from '../../helpers/media';
21
22
 
22
23
  class Media {
23
24
  public isDeviceLoaded = false;
@@ -53,7 +54,7 @@ class Media {
53
54
 
54
55
  get mediasoupDevice(): Device {
55
56
  if (!this.device) {
56
- this.device = new Device();
57
+ this.device = this.createDevice();
57
58
  }
58
59
 
59
60
  return this.device;
@@ -166,6 +167,16 @@ class Media {
166
167
  },
167
168
  };
168
169
  }
170
+
171
+ private createDevice(): Device {
172
+ const handlerName = detectHandlerName();
173
+
174
+ this.#logger.debug('Creating a media device', {
175
+ handlerName: handlerName ?? 'not specified',
176
+ });
177
+
178
+ return new Device({ handlerName });
179
+ }
169
180
  }
170
181
 
171
182
  export default Media;
@@ -0,0 +1,25 @@
1
+ import { types } from 'mediasoup-client';
2
+ import Bowser from 'bowser';
3
+
4
+ const chrome74Criteria = {
5
+ 'yandex browser': '>=22',
6
+ chrome: '>=74',
7
+ chromium: '>=74',
8
+ };
9
+
10
+ // eslint-disable-next-line import/prefer-default-export
11
+ export const detectHandlerName = (userAgent?: string): types.BuiltinHandlerName | undefined => {
12
+ const ua = userAgent ?? navigator?.userAgent;
13
+
14
+ if (!ua) {
15
+ return undefined;
16
+ }
17
+
18
+ const browser = Bowser.getParser(ua);
19
+
20
+ if (browser.satisfies(chrome74Criteria)) {
21
+ return 'Chrome74';
22
+ }
23
+
24
+ return undefined;
25
+ };