@daily-co/react-native-daily-js 0.38.0 → 0.40.0
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/README.md +3 -1
- package/dist/DailyMediaView.d.ts +1 -1
- package/dist/DailyMediaView.js +10 -6
- package/dist/iOSCallObjectBundleCache.d.ts +1 -1
- package/dist/iOSCallObjectBundleCache.js +3 -3
- package/dist/index.js +7 -3
- package/package.json +5 -5
- package/type-overrides/@daily-co/daily-js/index.d.ts +61 -8
package/README.md
CHANGED
|
@@ -15,11 +15,13 @@ Install `react-native-daily-js` along with its peer dependencies:
|
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
17
|
npm i @daily-co/react-native-daily-js @react-native-async-storage/async-storage@^1.15.7 react-native-background-timer@^2.3.1
|
|
18
|
-
npm i --save-exact @daily-co/react-native-webrtc@
|
|
18
|
+
npm i --save-exact @daily-co/react-native-webrtc@106.0.6-daily.1
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Then, follow the below steps to set up your native project on each platform. **Note that these steps assume you're using a version of React Native that supports autolinking (>= 60).**
|
|
22
22
|
|
|
23
|
+
> If your project uses [Expo](https://expo.dev/), use the [`config-plugin-rn-daily-js` configuration package](https://www.npmjs.com/package/@daily-co/config-plugin-rn-daily-js) instead of the following steps.
|
|
24
|
+
|
|
23
25
|
### iOS
|
|
24
26
|
|
|
25
27
|
Update the `platform` in your `Podfile`, since `@daily-co/react-native-webrtc` only works on iOS 11 and above:
|
package/dist/DailyMediaView.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ViewStyle } from 'react-native';
|
|
3
3
|
import { MediaStreamTrack, RTCViewProps } from '@daily-co/react-native-webrtc';
|
|
4
|
-
|
|
4
|
+
type Props = {
|
|
5
5
|
videoTrack: MediaStreamTrack | null;
|
|
6
6
|
audioTrack: MediaStreamTrack | null;
|
|
7
7
|
mirror?: RTCViewProps['mirror'];
|
package/dist/DailyMediaView.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
18
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
19
|
if (mod && mod.__esModule) return mod;
|
|
16
20
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
22
|
__setModuleDefault(result, mod);
|
|
19
23
|
return result;
|
|
20
24
|
};
|
|
@@ -24,8 +28,8 @@ var react_1 = require("react");
|
|
|
24
28
|
var react_native_1 = require("react-native");
|
|
25
29
|
var react_native_webrtc_1 = require("@daily-co/react-native-webrtc");
|
|
26
30
|
function DailyMediaView(props) {
|
|
27
|
-
var _a = react_1.useState(null), stream = _a[0], setStream = _a[1];
|
|
28
|
-
react_1.useEffect(function () {
|
|
31
|
+
var _a = (0, react_1.useState)(null), stream = _a[0], setStream = _a[1];
|
|
32
|
+
(0, react_1.useEffect)(function () {
|
|
29
33
|
var tracks = [props.videoTrack, props.audioTrack].filter(function (t) { return t; });
|
|
30
34
|
var stream = tracks.length > 0 ? new react_native_webrtc_1.MediaStream(tracks) : null;
|
|
31
35
|
setStream(stream);
|
|
@@ -37,8 +41,8 @@ function DailyMediaView(props) {
|
|
|
37
41
|
// and in fact triggers a bug where if it's hidden while in the background
|
|
38
42
|
// it gets "stuck" in the hidden state.
|
|
39
43
|
style={props.videoTrack || react_native_1.Platform.OS === 'android'
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
? props.style
|
|
45
|
+
: { display: 'none' }}/>) : null;
|
|
42
46
|
// provide empty placeholder when no video is playing, to try to avoid
|
|
43
47
|
// messing with any layout that depends on this DailyMediaView's style
|
|
44
48
|
var placeholderView = props.videoTrack ? null : (<react_native_1.View style={props.style}/>);
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -47,7 +47,7 @@ var FIELD_BUNDLE_ETAG = 'etag';
|
|
|
47
47
|
var REQUIRED_FIELDS = [FIELD_BUNDLE_CODE, FIELD_CACHE_EXPIRY];
|
|
48
48
|
var DEFAULT_EXPIRY_MS = 60 * 1000;
|
|
49
49
|
function cacheKeyForUrl(url) {
|
|
50
|
-
return "callobj_bundle_"
|
|
50
|
+
return "callobj_bundle_".concat(url);
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* A workaround for the fact that the iOS HTTP cache won't cache the call
|
|
@@ -79,7 +79,7 @@ var iOSCallObjectBundleCache = /** @class */ (function () {
|
|
|
79
79
|
for (_i = 0, REQUIRED_FIELDS_1 = REQUIRED_FIELDS; _i < REQUIRED_FIELDS_1.length; _i++) {
|
|
80
80
|
field = REQUIRED_FIELDS_1[_i];
|
|
81
81
|
if (!cacheItem[field]) {
|
|
82
|
-
throw new Error("Missing call object bundle cache item field: "
|
|
82
|
+
throw new Error("Missing call object bundle cache item field: ".concat(field));
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
// If cache expired, return headers needed to conditionally fetch the
|
package/dist/index.js
CHANGED
|
@@ -12,13 +12,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
14
|
if (k2 === undefined) k2 = k;
|
|
15
|
-
Object.
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
16
20
|
}) : (function(o, m, k, k2) {
|
|
17
21
|
if (k2 === undefined) k2 = k;
|
|
18
22
|
o[k2] = m[k];
|
|
19
23
|
}));
|
|
20
24
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
|
-
for (var p in m) if (p !== "default" && !
|
|
25
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
26
|
};
|
|
23
27
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
24
28
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -70,7 +74,7 @@ function setupEventListeners() {
|
|
|
70
74
|
}
|
|
71
75
|
function setupGlobals() {
|
|
72
76
|
// WebRTC APIs + global `window` object
|
|
73
|
-
react_native_webrtc_1.registerGlobals();
|
|
77
|
+
(0, react_native_webrtc_1.registerGlobals)();
|
|
74
78
|
// A shim to prevent errors in call machine bundle (not ideal)
|
|
75
79
|
global.window.addEventListener = function () { };
|
|
76
80
|
// A workaround for iOS HTTP cache not caching call object bundle due to size
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daily-co/react-native-daily-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"description": "React Native library for making video calls using Daily",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
"baseUrl": "https://github.com/daily-co/react-native-daily-js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@daily-co/daily-js": "^0.
|
|
29
|
+
"@daily-co/daily-js": "^0.42.2",
|
|
30
30
|
"@types/react-native-background-timer": "^2.0.0",
|
|
31
31
|
"react-native-url-polyfill": "^1.1.2"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@daily-co/react-native-webrtc": "
|
|
34
|
+
"@daily-co/react-native-webrtc": "^106.0.6-daily.1",
|
|
35
35
|
"@react-native-async-storage/async-storage": "^1.15.7",
|
|
36
36
|
"react-native-background-timer": "^2.3.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@daily-co/react-native-webrtc": "
|
|
39
|
+
"@daily-co/react-native-webrtc": "^106.0.6-daily.1",
|
|
40
40
|
"@react-native-async-storage/async-storage": "^1.15.7",
|
|
41
41
|
"react-native-background-timer": "^2.3.1",
|
|
42
|
-
"typescript": "^
|
|
42
|
+
"typescript": "^4.8.4"
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -61,6 +61,7 @@ export type DailyEvent =
|
|
|
61
61
|
| 'active-speaker-change'
|
|
62
62
|
| 'network-quality-change'
|
|
63
63
|
| 'network-connection'
|
|
64
|
+
| 'cpu-load-change'
|
|
64
65
|
| 'error'
|
|
65
66
|
| 'nonfatal-error'
|
|
66
67
|
| 'live-streaming-started'
|
|
@@ -105,7 +106,8 @@ export type DailyFatalErrorType =
|
|
|
105
106
|
| 'exp-token'
|
|
106
107
|
| 'meeting-full'
|
|
107
108
|
| 'end-of-life'
|
|
108
|
-
| 'not-allowed'
|
|
109
|
+
| 'not-allowed'
|
|
110
|
+
| 'connection-error';
|
|
109
111
|
|
|
110
112
|
export type DailyNonFatalErrorType =
|
|
111
113
|
| 'remote-media-player-error'
|
|
@@ -148,7 +150,7 @@ export interface DailyLoadOptions extends DailyCallOptions {
|
|
|
148
150
|
}
|
|
149
151
|
|
|
150
152
|
export interface DailyFactoryOptions extends DailyCallOptions {
|
|
151
|
-
|
|
153
|
+
strictMode?: boolean; // only available at constructor time
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
export interface CamSimulcastEncoding {
|
|
@@ -333,6 +335,35 @@ export interface DailyNetworkStats {
|
|
|
333
335
|
threshold: 'good' | 'low' | 'very-low';
|
|
334
336
|
}
|
|
335
337
|
|
|
338
|
+
export interface DailyCpuLoadStats {
|
|
339
|
+
cpuLoadState: 'low' | 'high';
|
|
340
|
+
cpuLoadStateReason: 'encode' | 'decode' | 'scheduleDuration' | 'none'; // We are currently not using the Inter frame Delay to change the cpu load state
|
|
341
|
+
stats: {
|
|
342
|
+
latest: {
|
|
343
|
+
timestamp: number;
|
|
344
|
+
scheduleDuration: number;
|
|
345
|
+
frameEncodeTimeSec: number;
|
|
346
|
+
targetEncodeFrameRate: number;
|
|
347
|
+
targetDecodeFrameRate: number;
|
|
348
|
+
targetScheduleDuration: number;
|
|
349
|
+
cpuUsageBasedOnTargetEncode: number;
|
|
350
|
+
cpuUsageBasedOnGlobalDecode: number;
|
|
351
|
+
avgFrameDecodeTimeSec: number;
|
|
352
|
+
avgInterFrameDelayStandardDeviation: number;
|
|
353
|
+
totalReceivedVideoTracks: number;
|
|
354
|
+
cpuInboundVideoStats: {
|
|
355
|
+
trackId: string;
|
|
356
|
+
ssrc: number;
|
|
357
|
+
frameWidth: number;
|
|
358
|
+
frameHeight: number;
|
|
359
|
+
fps: number;
|
|
360
|
+
frameDecodeTimeSec: number;
|
|
361
|
+
interFrameDelayStandardDeviation: number;
|
|
362
|
+
}[];
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
|
|
336
367
|
export interface DailyPendingRoomInfo {
|
|
337
368
|
roomUrlPendingJoin: string;
|
|
338
369
|
}
|
|
@@ -458,7 +489,6 @@ export interface DailyEventObjectNoPayload {
|
|
|
458
489
|
|
|
459
490
|
export type DailyCameraError = {
|
|
460
491
|
msg: string;
|
|
461
|
-
localizedMsg?: string;
|
|
462
492
|
};
|
|
463
493
|
|
|
464
494
|
export interface DailyCamPermissionsError extends DailyCameraError {
|
|
@@ -517,13 +547,27 @@ export interface DailyEventObjectCameraError {
|
|
|
517
547
|
error: DailyCameraErrorObject;
|
|
518
548
|
}
|
|
519
549
|
|
|
550
|
+
export type DailyFatalError = {
|
|
551
|
+
type: DailyFatalErrorType;
|
|
552
|
+
msg: string;
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
export interface DailyFatalConnectionError extends DailyFatalError {
|
|
556
|
+
type: Extract<DailyFatalConnectionError, 'connection-error'>;
|
|
557
|
+
details: {
|
|
558
|
+
on: 'join' | 'reconnect';
|
|
559
|
+
sourceError: Error;
|
|
560
|
+
uri?: string;
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
export type DailyFatalErrorObject<T extends DailyFatalError = any> =
|
|
565
|
+
T extends DailyFatalConnectionError['type'] ? DailyFatalConnectionError : any;
|
|
566
|
+
|
|
520
567
|
export interface DailyEventObjectFatalError {
|
|
521
568
|
action: Extract<DailyEvent, 'error'>;
|
|
522
569
|
errorMsg: string;
|
|
523
|
-
error?:
|
|
524
|
-
type: DailyFatalErrorType;
|
|
525
|
-
localizedMsg?: string;
|
|
526
|
-
};
|
|
570
|
+
error?: DailyFatalErrorObject;
|
|
527
571
|
}
|
|
528
572
|
|
|
529
573
|
export interface DailyEventObjectNonFatalError {
|
|
@@ -632,6 +676,12 @@ export interface DailyEventObjectNetworkQualityEvent {
|
|
|
632
676
|
quality: number;
|
|
633
677
|
}
|
|
634
678
|
|
|
679
|
+
export interface DailyEventObjectCpuLoadEvent {
|
|
680
|
+
action: Extract<DailyEvent, 'cpu-load-change'>;
|
|
681
|
+
cpuLoadState: 'low' | 'high';
|
|
682
|
+
cpuLoadStateReason: 'encode' | 'decode' | 'scheduleDuration' | 'none'; // We are currently not using the Inter frame Delay to change the cpu load state
|
|
683
|
+
}
|
|
684
|
+
|
|
635
685
|
export type DailyNetworkConnectionType = 'signaling' | 'peer-to-peer' | 'sfu';
|
|
636
686
|
|
|
637
687
|
export interface DailyEventObjectNetworkConnectionEvent {
|
|
@@ -760,6 +810,8 @@ export type DailyEventObject<T extends DailyEvent = any> =
|
|
|
760
810
|
? DailyEventObjectRemoteMediaPlayerStopped
|
|
761
811
|
: T extends DailyEventObjectNetworkQualityEvent['action']
|
|
762
812
|
? DailyEventObjectNetworkQualityEvent
|
|
813
|
+
: T extends DailyEventObjectCpuLoadEvent['action']
|
|
814
|
+
? DailyEventObjectCpuLoadEvent
|
|
763
815
|
: T extends DailyEventObjectNetworkConnectionEvent['action']
|
|
764
816
|
? DailyEventObjectNetworkConnectionEvent
|
|
765
817
|
: T extends DailyEventObjectActiveSpeakerChange['action']
|
|
@@ -807,7 +859,7 @@ export interface DailyStreamingPortraitLayoutConfig {
|
|
|
807
859
|
|
|
808
860
|
export interface DailyStreamingCustomLayoutConfig {
|
|
809
861
|
preset: 'custom';
|
|
810
|
-
composition_id
|
|
862
|
+
composition_id?: string;
|
|
811
863
|
composition_params?: {
|
|
812
864
|
[key: string]: boolean | number | string;
|
|
813
865
|
};
|
|
@@ -1004,6 +1056,7 @@ export interface DailyCall {
|
|
|
1004
1056
|
}): void;
|
|
1005
1057
|
stopRecording(options?: { instanceId: string }): void;
|
|
1006
1058
|
getNetworkStats(): Promise<DailyNetworkStats>;
|
|
1059
|
+
getCpuLoadStats(): Promise<DailyCpuLoadStats>;
|
|
1007
1060
|
subscribeToTracksAutomatically(): boolean;
|
|
1008
1061
|
setSubscribeToTracksAutomatically(enabled: boolean): DailyCall;
|
|
1009
1062
|
enumerateDevices(): Promise<{ devices: MediaDeviceInfo[] }>;
|