@daily-co/react-native-daily-js 0.20.0 → 0.23.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 CHANGED
@@ -15,7 +15,7 @@ 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@1.89.2-daily.3
18
+ npm i --save-exact @daily-co/react-native-webrtc@1.94.1-daily.2
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).**
@@ -108,22 +108,6 @@ minSdkVersion = 24
108
108
 
109
109
  (If you run into any issues, refer to [Github issues](https://github.com/react-native-webrtc/react-native-webrtc/issues/720) like [these](https://github.com/jitsi/jitsi-meet/issues/4778), or the `react-native-webrtc` [installation docs](https://github.com/react-native-webrtc/react-native-webrtc/blob/master/Documentation/AndroidInstallation.md), which walk you through a more complicated process. The simpler process laid out above seems to work in a vanilla modern React Native CLI-based setup).
110
110
 
111
- ## Room configuration
112
-
113
- Your Daily room must be configured in a particular way in order for a `react-native-daily-js` client to be able to connect to it: it must specify the property `signaling_impl: ws`.
114
-
115
- To create a room with the `signaling_impl` property set appropriately, run the following (replacing `<your-api-key>` with your actual API key):
116
-
117
- ```bash
118
- curl --request POST \
119
- --url https://api.daily.co/v1/rooms \
120
- --header 'authorization: Bearer <your-api-key>' \
121
- --header 'content-type: application/json' \
122
- --data '{"properties":{"signaling_impl":"ws"}}'
123
- ```
124
-
125
- Of course, you may also want to specify a name as well as other properties. See the [Daily REST API docs](https://docs.daily.co/reference#rooms) for general guidance on how to create a new room or update an existing room.
126
-
127
111
  ## Usage
128
112
 
129
113
  `react-native-daily-js` is the React Native counterpart to `daily-js`, and can be used in pretty much the same way to add video calls to your apps. [Complete documentation for `react-native-daily-js` (as well as `daily-js`) can be found here](https://docs.daily.co/reference#using-the-react-native-daily-js-library).
@@ -1,9 +1,21 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
2
14
  var __importStar = (this && this.__importStar) || function (mod) {
3
15
  if (mod && mod.__esModule) return mod;
4
16
  var result = {};
5
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6
- result["default"] = mod;
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
7
19
  return result;
8
20
  };
9
21
  Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.js CHANGED
@@ -10,13 +10,21 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- function __export(m) {
14
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
15
- }
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
22
+ };
16
23
  var __importDefault = (this && this.__importDefault) || function (mod) {
17
24
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
25
  };
19
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.DailyMediaView = void 0;
20
28
  var daily_js_1 = __importDefault(require("@daily-co/daily-js"));
21
29
  var react_native_webrtc_1 = require("@daily-co/react-native-webrtc");
22
30
  var DailyMediaView_1 = __importDefault(require("./DailyMediaView"));
@@ -97,5 +105,5 @@ function setupGlobals() {
97
105
  setupEventListeners();
98
106
  setupGlobals();
99
107
  exports.default = daily_js_1.default;
100
- __export(require("@daily-co/daily-js"));
101
- __export(require("@daily-co/react-native-webrtc"));
108
+ __exportStar(require("@daily-co/daily-js"), exports);
109
+ __exportStar(require("@daily-co/react-native-webrtc"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daily-co/react-native-daily-js",
3
- "version": "0.20.0",
3
+ "version": "0.23.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,17 +26,18 @@
26
26
  "baseUrl": "https://github.com/daily-co/react-native-daily-js"
27
27
  },
28
28
  "dependencies": {
29
- "@daily-co/daily-js": "^0.22.0",
29
+ "@daily-co/daily-js": "^0.25.0",
30
30
  "@types/react-native-background-timer": "^2.0.0",
31
31
  "react-native-url-polyfill": "^1.1.2"
32
32
  },
33
+ "//": "WHEN ONE OF THESE CHANGE, PLEASE UPDATE README.md INSTALL SNIPPET ACCORDINGLY",
33
34
  "peerDependencies": {
34
- "@daily-co/react-native-webrtc": "1.89.2-daily.4",
35
+ "@daily-co/react-native-webrtc": "1.94.1-daily.2",
35
36
  "@react-native-async-storage/async-storage": "^1.15.7",
36
37
  "react-native-background-timer": "^2.3.1"
37
38
  },
38
39
  "devDependencies": {
39
- "@daily-co/react-native-webrtc": "1.89.2-daily.4",
40
+ "@daily-co/react-native-webrtc": "1.94.1-daily.2",
40
41
  "@react-native-async-storage/async-storage": "^1.15.7",
41
42
  "react-native-background-timer": "^2.3.1",
42
43
  "typescript": "^3.8.3"
@@ -6,7 +6,11 @@
6
6
  * --- REACT-NATIVE-SPECIFIC TYPES ---
7
7
  */
8
8
 
9
- import { MediaStreamTrack } from '@daily-co/react-native-webrtc';
9
+ import {
10
+ MediaStreamTrack,
11
+ MediaDeviceInfo,
12
+ MediaTrackConstraints,
13
+ } from '@daily-co/react-native-webrtc';
10
14
 
11
15
  /**
12
16
  * --- DAILY-JS API EXPOSED VIA REACT-NATIVE-DAILY-JS ---
@@ -45,14 +49,22 @@ export type DailyEvent =
45
49
  | 'participant-left'
46
50
  | 'track-started'
47
51
  | 'track-stopped'
52
+ | 'recording-started'
53
+ | 'recording-stopped'
54
+ | 'recording-stats'
55
+ | 'recording-error'
48
56
  | 'app-message'
49
57
  | 'active-speaker-change'
50
58
  | 'network-quality-change'
51
59
  | 'network-connection'
52
60
  | 'error'
61
+ | 'nonfatal-error'
53
62
  | 'live-streaming-started'
54
63
  | 'live-streaming-stopped'
55
64
  | 'live-streaming-error'
65
+ | 'remote-media-player-started'
66
+ | 'remote-media-player-stopped'
67
+ | 'remote-media-player-updated'
56
68
  | 'access-state-updated'
57
69
  | 'waiting-participant-added'
58
70
  | 'waiting-participant-updated'
@@ -75,6 +87,8 @@ export type DailyFatalErrorType =
75
87
  | 'exp-room'
76
88
  | 'exp-token';
77
89
 
90
+ export type DailyNonFatalErrorType = 'remote-media-player-error';
91
+
78
92
  export interface DailyParticipantsObject {
79
93
  local: DailyParticipant;
80
94
  [id: string]: DailyParticipant;
@@ -107,6 +121,7 @@ export interface DailyLoadOptions extends DailyCallOptions {
107
121
 
108
122
  export interface DailyAdvancedConfig {
109
123
  experimentalGetUserMediaConstraintsModify?: (constraints: any) => void;
124
+ userMediaVideoConstraints?: boolean | MediaTrackConstraints;
110
125
  preferH264ForCam?: boolean;
111
126
  h264Profile?: string;
112
127
  }
@@ -174,6 +189,7 @@ export interface DailyParticipant {
174
189
  will_eject_at: Date;
175
190
  local: boolean;
176
191
  owner: boolean;
192
+ record: boolean;
177
193
 
178
194
  // video element info (iframe-based calls using standard UI only)
179
195
  cam_info: {} | DailyVideoElementInfo;
@@ -228,6 +244,8 @@ export interface DailyNetworkStats {
228
244
  videoRecvPacketLoss: number;
229
245
  videoSendBitsPerSecond: number;
230
246
  videoSendPacketLoss: number;
247
+ totalSendPacketLoss: number;
248
+ totalRecvPacketLoss: number;
231
249
  };
232
250
  worstVideoRecvPacketLoss: number;
233
251
  worstVideoSendPacketLoss: number;
@@ -251,6 +269,7 @@ export interface DailyRoomInfo {
251
269
  enable_knocking?: boolean;
252
270
  enable_network_ui?: boolean;
253
271
  enable_people_ui?: boolean;
272
+ enable_pip_ui?: boolean;
254
273
  enable_prejoin_ui?: boolean;
255
274
  enable_video_processing_ui?: boolean;
256
275
  start_video_off?: boolean;
@@ -280,6 +299,7 @@ export interface DailyRoomInfo {
280
299
  max_live_streams?: number;
281
300
  enable_network_ui?: boolean;
282
301
  enable_people_ui?: boolean;
302
+ enable_pip_ui?: boolean;
283
303
  enable_prejoin_ui?: boolean;
284
304
  enable_video_processing_ui?: boolean;
285
305
  };
@@ -337,6 +357,9 @@ export interface DailyEventObjectNoPayload {
337
357
  | 'loaded'
338
358
  | 'joining-meeting'
339
359
  | 'left-meeting'
360
+ | 'recording-stopped'
361
+ | 'recording-stats'
362
+ | 'recording-error'
340
363
  | 'live-streaming-started'
341
364
  | 'live-streaming-stopped'
342
365
  >;
@@ -351,6 +374,12 @@ export interface DailyEventObjectFatalError {
351
374
  };
352
375
  }
353
376
 
377
+ export interface DailyEventObjectNonFatalError {
378
+ action: Extract<DailyEvent, 'nonfatal-error'>;
379
+ type: DailyNonFatalErrorType;
380
+ errorMsg: string;
381
+ }
382
+
354
383
  export interface DailyEventObjectGenericError {
355
384
  action: Extract<
356
385
  DailyEvent,
@@ -392,6 +421,15 @@ export interface DailyEventObjectTrack {
392
421
  track: MediaStreamTrack;
393
422
  }
394
423
 
424
+ export interface DailyEventObjectRecordingStarted {
425
+ action: Extract<DailyEvent, 'recording-started'>;
426
+ local?: boolean;
427
+ recordingId?: string;
428
+ startedBy?: string;
429
+ type?: string;
430
+ layout?: DailyStreamingLayoutConfig;
431
+ }
432
+
395
433
  export interface DailyEventObjectNetworkQualityEvent {
396
434
  action: Extract<DailyEvent, 'network-quality-change'>;
397
435
  threshold: string;
@@ -426,6 +464,28 @@ export interface DailyEventObjectReceiveSettingsUpdated {
426
464
  receiveSettings: DailyReceiveSettings;
427
465
  }
428
466
 
467
+ export interface DailyEventObjectLiveStreamingStarted {
468
+ action: Extract<DailyEvent, 'live-streaming-started'>;
469
+ layout?: DailyStreamingLayoutConfig;
470
+ }
471
+
472
+ export interface DailyEventObjectRemoteMediaPlayerUpdate {
473
+ action: Extract<
474
+ DailyEvent,
475
+ 'remote-media-player-started' | 'remote-media-player-updated'
476
+ >;
477
+ updatedBy: string;
478
+ session_id: string;
479
+ remoteMediaPlayerState: DailyRemoteMediaPlayerState;
480
+ }
481
+
482
+ export interface DailyEventObjectRemoteMediaPlayerStopped {
483
+ action: Extract<DailyEvent, 'remote-media-player-stopped'>;
484
+ session_id: string;
485
+ updatedBy: string;
486
+ reason: DailyRemoteMediaPlayerStopReason;
487
+ }
488
+
429
489
  export type DailyEventObject<
430
490
  T extends DailyEvent = any
431
491
  > = T extends DailyEventObjectAppMessage['action']
@@ -434,6 +494,8 @@ export type DailyEventObject<
434
494
  ? DailyEventObjectNoPayload
435
495
  : T extends DailyEventObjectFatalError['action']
436
496
  ? DailyEventObjectFatalError
497
+ : T extends DailyEventObjectNonFatalError['action']
498
+ ? DailyEventObjectNonFatalError
437
499
  : T extends DailyEventObjectGenericError['action']
438
500
  ? DailyEventObjectGenericError
439
501
  : T extends DailyEventObjectParticipants['action']
@@ -446,6 +508,12 @@ export type DailyEventObject<
446
508
  ? DailyEventObjectAccessState
447
509
  : T extends DailyEventObjectTrack['action']
448
510
  ? DailyEventObjectTrack
511
+ : T extends DailyEventObjectRecordingStarted['action']
512
+ ? DailyEventObjectRecordingStarted
513
+ : T extends DailyEventObjectRemoteMediaPlayerUpdate['action']
514
+ ? DailyEventObjectRemoteMediaPlayerUpdate
515
+ : T extends DailyEventObjectRemoteMediaPlayerStopped['action']
516
+ ? DailyEventObjectRemoteMediaPlayerStopped
449
517
  : T extends DailyEventObjectNetworkQualityEvent['action']
450
518
  ? DailyEventObjectNetworkQualityEvent
451
519
  : T extends DailyEventObjectNetworkConnectionEvent['action']
@@ -496,6 +564,20 @@ export type DailyStreamingLayoutConfig =
496
564
  | DailyStreamingActiveParticipantLayoutConfig
497
565
  | DailyStreamingPortraitLayoutConfig;
498
566
 
567
+ export type DailyRemoteMediaPlayerSettingPlay = 'play';
568
+ export type DailyRemoteMediaPlayerSettingPause = 'pause';
569
+
570
+ export type DailyRemoteMediaPlayerStatePlaying = 'playing';
571
+ export type DailyRemoteMediaPlayerStatePaused = 'paused';
572
+ export type DailyRemoteMediaPlayerStateBuffering = 'buffering';
573
+
574
+ export type DailyRemoteMediaPlayerEOS = 'EOS';
575
+ export type DailyRemoteMediaPlayerPeerStopped = 'stopped-by-peer';
576
+
577
+ export type DailyRemoteMediaPlayerStopReason =
578
+ | DailyRemoteMediaPlayerEOS
579
+ | DailyRemoteMediaPlayerPeerStopped;
580
+
499
581
  export type DailyAccess = 'unknown' | SpecifiedDailyAccess;
500
582
 
501
583
  export type SpecifiedDailyAccess = { level: 'none' | 'lobby' | 'full' };
@@ -510,6 +592,51 @@ export type DailyAccessRequest = {
510
592
  name: string;
511
593
  };
512
594
 
595
+ export interface DailyStreamingOptions {
596
+ width?: number;
597
+ height?: number;
598
+ backgroundColor?: string;
599
+ layout?: DailyStreamingLayoutConfig;
600
+ }
601
+
602
+ export interface DailyLiveStreamingOptions extends DailyStreamingOptions {
603
+ rtmpUrl: string;
604
+ }
605
+
606
+ export interface RemoteMediaPlayerSimulcastEncoding {
607
+ maxBitrate: number;
608
+ maxFramerate?: number;
609
+ scaleResolutionDownBy?: number;
610
+ }
611
+
612
+ export interface DailyRemoteMediaPlayerSettings {
613
+ state: DailyRemoteMediaPlayerSettingPlay | DailyRemoteMediaPlayerSettingPause;
614
+ simulcastEncodings?: RemoteMediaPlayerSimulcastEncoding[];
615
+ }
616
+
617
+ export interface DailyRemoteMediaPlayerStartOptions {
618
+ url: string;
619
+ settings?: DailyRemoteMediaPlayerSettings;
620
+ }
621
+
622
+ export interface DailyRemoteMediaPlayerUpdateOptions {
623
+ session_id: string;
624
+ settings: DailyRemoteMediaPlayerSettings;
625
+ }
626
+
627
+ export interface DailyRemoteMediaPlayerState {
628
+ state:
629
+ | DailyRemoteMediaPlayerStatePlaying
630
+ | DailyRemoteMediaPlayerStatePaused
631
+ | DailyRemoteMediaPlayerStateBuffering;
632
+ settings: DailyRemoteMediaPlayerSettings;
633
+ }
634
+
635
+ export interface DailyRemoteMediaPlayerInfo {
636
+ session_id: string;
637
+ remoteMediaPlayerState: DailyRemoteMediaPlayerState;
638
+ }
639
+
513
640
  export interface DailyCall {
514
641
  join(properties?: DailyCallOptions): Promise<DailyParticipantsObject | void>;
515
642
  leave(): Promise<void>;
@@ -556,20 +683,25 @@ export interface DailyCall {
556
683
  setNativeInCallAudioMode(
557
684
  inCallAudioMode: DailyNativeInCallAudioMode
558
685
  ): DailyCall;
559
- startLiveStreaming(options: {
560
- rtmpUrl: string;
561
- width?: number;
562
- height?: number;
563
- backgroundColor?: string;
564
- layout?: DailyStreamingLayoutConfig;
565
- }): void;
686
+ startLiveStreaming(options: DailyLiveStreamingOptions): void;
566
687
  updateLiveStreaming(options: { layout?: DailyStreamingLayoutConfig }): void;
567
688
  stopLiveStreaming(): void;
689
+ startRemoteMediaPlayer(
690
+ options: DailyRemoteMediaPlayerStartOptions
691
+ ): Promise<DailyRemoteMediaPlayerInfo>;
692
+ stopRemoteMediaPlayer(session_id: string): Promise<void>;
693
+ updateRemoteMediaPlayer(
694
+ options: DailyRemoteMediaPlayerUpdateOptions
695
+ ): Promise<DailyRemoteMediaPlayerInfo>;
568
696
  preAuth(properties?: DailyCallOptions): Promise<{ access: DailyAccess }>;
569
697
  load(properties?: DailyLoadOptions): Promise<void>;
698
+ startRecording(options?: DailyStreamingOptions): void;
699
+ updateRecording(options: { layout?: DailyStreamingLayoutConfig }): void;
700
+ stopRecording(): void;
570
701
  getNetworkStats(): Promise<DailyNetworkStats>;
571
702
  subscribeToTracksAutomatically(): boolean;
572
703
  setSubscribeToTracksAutomatically(enabled: boolean): DailyCall;
704
+ enumerateDevices(): Promise<{ devices: MediaDeviceInfo[] }>;
573
705
  sendAppMessage(data: any, to?: string): DailyCall;
574
706
  setUserName(name: string): Promise<{ userName: string }>;
575
707
  room(options?: {