@daily-co/react-native-daily-js 0.17.0 → 0.21.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).
@@ -30,7 +30,7 @@ buildscript {
30
30
  if (project == rootProject) {
31
31
  repositories {
32
32
  google()
33
- jcenter()
33
+ mavenCentral()
34
34
  }
35
35
  dependencies {
36
36
  classpath 'com.android.tools.build:gradle:3.4.1'
@@ -71,7 +71,7 @@ repositories {
71
71
  url "$rootDir/../node_modules/jsc-android/dist"
72
72
  }
73
73
  google()
74
- jcenter()
74
+ mavenCentral()
75
75
  }
76
76
 
77
77
  dependencies {
@@ -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.17.0",
3
+ "version": "0.21.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,18 +26,17 @@
26
26
  "baseUrl": "https://github.com/daily-co/react-native-daily-js"
27
27
  },
28
28
  "dependencies": {
29
- "@daily-co/daily-js": "^0.20.0",
29
+ "@daily-co/daily-js": "^0.23.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",
34
33
  "peerDependencies": {
35
- "@daily-co/react-native-webrtc": "1.89.2-daily.3",
34
+ "@daily-co/react-native-webrtc": "1.94.1-daily.2",
36
35
  "@react-native-async-storage/async-storage": "^1.15.7",
37
36
  "react-native-background-timer": "^2.3.1"
38
37
  },
39
38
  "devDependencies": {
40
- "@daily-co/react-native-webrtc": "1.89.2-daily.3",
39
+ "@daily-co/react-native-webrtc": "1.94.1-daily.2",
41
40
  "@react-native-async-storage/async-storage": "^1.15.7",
42
41
  "react-native-background-timer": "^2.3.1",
43
42
  "typescript": "^3.8.3"
@@ -6,7 +6,10 @@
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
+ } from '@daily-co/react-native-webrtc';
10
13
 
11
14
  /**
12
15
  * --- DAILY-JS API EXPOSED VIA REACT-NATIVE-DAILY-JS ---
@@ -45,14 +48,22 @@ export type DailyEvent =
45
48
  | 'participant-left'
46
49
  | 'track-started'
47
50
  | 'track-stopped'
51
+ | 'recording-started'
52
+ | 'recording-stopped'
53
+ | 'recording-stats'
54
+ | 'recording-error'
48
55
  | 'app-message'
49
56
  | 'active-speaker-change'
50
57
  | 'network-quality-change'
51
58
  | 'network-connection'
52
59
  | 'error'
60
+ | 'nonfatal-error'
53
61
  | 'live-streaming-started'
54
62
  | 'live-streaming-stopped'
55
63
  | 'live-streaming-error'
64
+ | 'remote-media-player-started'
65
+ | 'remote-media-player-stopped'
66
+ | 'remote-media-player-updated'
56
67
  | 'access-state-updated'
57
68
  | 'waiting-participant-added'
58
69
  | 'waiting-participant-updated'
@@ -75,6 +86,12 @@ export type DailyFatalErrorType =
75
86
  | 'exp-room'
76
87
  | 'exp-token';
77
88
 
89
+ export type DailyNonFatalErrorType =
90
+ | 'input-settings-error'
91
+ | 'screen-share-error'
92
+ | 'video-processor-error'
93
+ | 'remote-media-player-error';
94
+
78
95
  export interface DailyParticipantsObject {
79
96
  local: DailyParticipant;
80
97
  [id: string]: DailyParticipant;
@@ -174,6 +191,7 @@ export interface DailyParticipant {
174
191
  will_eject_at: Date;
175
192
  local: boolean;
176
193
  owner: boolean;
194
+ record: boolean;
177
195
 
178
196
  // video element info (iframe-based calls using standard UI only)
179
197
  cam_info: {} | DailyVideoElementInfo;
@@ -250,6 +268,7 @@ export interface DailyRoomInfo {
250
268
  enable_chat?: boolean;
251
269
  enable_knocking?: boolean;
252
270
  enable_network_ui?: boolean;
271
+ enable_people_ui?: boolean;
253
272
  enable_prejoin_ui?: boolean;
254
273
  enable_video_processing_ui?: boolean;
255
274
  start_video_off?: boolean;
@@ -278,6 +297,7 @@ export interface DailyRoomInfo {
278
297
  webhook_meeting_end?: any;
279
298
  max_live_streams?: number;
280
299
  enable_network_ui?: boolean;
300
+ enable_people_ui?: boolean;
281
301
  enable_prejoin_ui?: boolean;
282
302
  enable_video_processing_ui?: boolean;
283
303
  };
@@ -335,6 +355,9 @@ export interface DailyEventObjectNoPayload {
335
355
  | 'loaded'
336
356
  | 'joining-meeting'
337
357
  | 'left-meeting'
358
+ | 'recording-stopped'
359
+ | 'recording-stats'
360
+ | 'recording-error'
338
361
  | 'live-streaming-started'
339
362
  | 'live-streaming-stopped'
340
363
  >;
@@ -349,6 +372,12 @@ export interface DailyEventObjectFatalError {
349
372
  };
350
373
  }
351
374
 
375
+ export interface DailyEventObjectNonFatalError {
376
+ action: Extract<DailyEvent, 'nonfatal-error'>;
377
+ type: DailyNonFatalErrorType;
378
+ errorMsg: string;
379
+ }
380
+
352
381
  export interface DailyEventObjectGenericError {
353
382
  action: Extract<
354
383
  DailyEvent,
@@ -390,6 +419,15 @@ export interface DailyEventObjectTrack {
390
419
  track: MediaStreamTrack;
391
420
  }
392
421
 
422
+ export interface DailyEventObjectRecordingStarted {
423
+ action: Extract<DailyEvent, 'recording-started'>;
424
+ local?: boolean;
425
+ recordingId?: string;
426
+ startedBy?: string;
427
+ type?: string;
428
+ layout?: DailyStreamingLayoutConfig;
429
+ }
430
+
393
431
  export interface DailyEventObjectNetworkQualityEvent {
394
432
  action: Extract<DailyEvent, 'network-quality-change'>;
395
433
  threshold: string;
@@ -424,6 +462,28 @@ export interface DailyEventObjectReceiveSettingsUpdated {
424
462
  receiveSettings: DailyReceiveSettings;
425
463
  }
426
464
 
465
+ export interface DailyEventObjectLiveStreamingStarted {
466
+ action: Extract<DailyEvent, 'live-streaming-started'>;
467
+ layout?: DailyStreamingLayoutConfig;
468
+ }
469
+
470
+ export interface DailyEventObjectRemoteMediaPlayerUpdate {
471
+ action: Extract<
472
+ DailyEvent,
473
+ 'remote-media-player-started' | 'remote-media-player-updated'
474
+ >;
475
+ updatedBy: string;
476
+ session_id: string;
477
+ remoteMediaPlayerState: DailyRemoteMediaPlayerState;
478
+ }
479
+
480
+ export interface DailyEventObjectRemoteMediaPlayerStopped {
481
+ action: Extract<DailyEvent, 'remote-media-player-stopped'>;
482
+ session_id: string;
483
+ updatedBy: string;
484
+ reason: DailyRemoteMediaPlayerStopReason;
485
+ }
486
+
427
487
  export type DailyEventObject<
428
488
  T extends DailyEvent = any
429
489
  > = T extends DailyEventObjectAppMessage['action']
@@ -432,6 +492,8 @@ export type DailyEventObject<
432
492
  ? DailyEventObjectNoPayload
433
493
  : T extends DailyEventObjectFatalError['action']
434
494
  ? DailyEventObjectFatalError
495
+ : T extends DailyEventObjectNonFatalError['action']
496
+ ? DailyEventObjectNonFatalError
435
497
  : T extends DailyEventObjectGenericError['action']
436
498
  ? DailyEventObjectGenericError
437
499
  : T extends DailyEventObjectParticipants['action']
@@ -444,6 +506,12 @@ export type DailyEventObject<
444
506
  ? DailyEventObjectAccessState
445
507
  : T extends DailyEventObjectTrack['action']
446
508
  ? DailyEventObjectTrack
509
+ : T extends DailyEventObjectRecordingStarted['action']
510
+ ? DailyEventObjectRecordingStarted
511
+ : T extends DailyEventObjectRemoteMediaPlayerUpdate['action']
512
+ ? DailyEventObjectRemoteMediaPlayerUpdate
513
+ : T extends DailyEventObjectRemoteMediaPlayerStopped['action']
514
+ ? DailyEventObjectRemoteMediaPlayerStopped
447
515
  : T extends DailyEventObjectNetworkQualityEvent['action']
448
516
  ? DailyEventObjectNetworkQualityEvent
449
517
  : T extends DailyEventObjectNetworkConnectionEvent['action']
@@ -494,6 +562,20 @@ export type DailyStreamingLayoutConfig =
494
562
  | DailyStreamingActiveParticipantLayoutConfig
495
563
  | DailyStreamingPortraitLayoutConfig;
496
564
 
565
+ export type DailyRemoteMediaPlayerSettingPlay = 'play';
566
+ export type DailyRemoteMediaPlayerSettingPause = 'pause';
567
+
568
+ export type DailyRemoteMediaPlayerStatePlaying = 'playing';
569
+ export type DailyRemoteMediaPlayerStatePaused = 'paused';
570
+ export type DailyRemoteMediaPlayerStateBuffering = 'buffering';
571
+
572
+ export type DailyRemoteMediaPlayerEOS = 'EOS';
573
+ export type DailyRemoteMediaPlayerPeerStopped = 'stopped-by-peer';
574
+
575
+ export type DailyRemoteMediaPlayerStopReason =
576
+ | DailyRemoteMediaPlayerEOS
577
+ | DailyRemoteMediaPlayerPeerStopped;
578
+
497
579
  export type DailyAccess = 'unknown' | SpecifiedDailyAccess;
498
580
 
499
581
  export type SpecifiedDailyAccess = { level: 'none' | 'lobby' | 'full' };
@@ -508,6 +590,51 @@ export type DailyAccessRequest = {
508
590
  name: string;
509
591
  };
510
592
 
593
+ export interface DailyStreamingOptions {
594
+ width?: number;
595
+ height?: number;
596
+ backgroundColor?: string;
597
+ layout?: DailyStreamingLayoutConfig;
598
+ }
599
+
600
+ export interface DailyLiveStreamingOptions extends DailyStreamingOptions {
601
+ rtmpUrl: string;
602
+ }
603
+
604
+ export interface RemoteMediaPlayerSimulcastEncoding {
605
+ maxBitrate: number;
606
+ maxFramerate?: number;
607
+ scaleResolutionDownBy?: number;
608
+ }
609
+
610
+ export interface DailyRemoteMediaPlayerSettings {
611
+ state: DailyRemoteMediaPlayerSettingPlay | DailyRemoteMediaPlayerSettingPause;
612
+ simulcastEncodings?: RemoteMediaPlayerSimulcastEncoding[];
613
+ }
614
+
615
+ export interface DailyRemoteMediaPlayerStartOptions {
616
+ url: string;
617
+ settings?: DailyRemoteMediaPlayerSettings;
618
+ }
619
+
620
+ export interface DailyRemoteMediaPlayerUpdateOptions {
621
+ session_id: string;
622
+ settings: DailyRemoteMediaPlayerSettings;
623
+ }
624
+
625
+ export interface DailyRemoteMediaPlayerState {
626
+ state:
627
+ | DailyRemoteMediaPlayerStatePlaying
628
+ | DailyRemoteMediaPlayerStatePaused
629
+ | DailyRemoteMediaPlayerStateBuffering;
630
+ settings: DailyRemoteMediaPlayerSettings;
631
+ }
632
+
633
+ export interface DailyRemoteMediaPlayerInfo {
634
+ session_id: string;
635
+ remoteMediaPlayerState: DailyRemoteMediaPlayerState;
636
+ }
637
+
511
638
  export interface DailyCall {
512
639
  join(properties?: DailyCallOptions): Promise<DailyParticipantsObject | void>;
513
640
  leave(): Promise<void>;
@@ -554,20 +681,25 @@ export interface DailyCall {
554
681
  setNativeInCallAudioMode(
555
682
  inCallAudioMode: DailyNativeInCallAudioMode
556
683
  ): DailyCall;
557
- startLiveStreaming(options: {
558
- rtmpUrl: string;
559
- width?: number;
560
- height?: number;
561
- backgroundColor?: string;
562
- layout?: DailyStreamingLayoutConfig;
563
- }): void;
684
+ startLiveStreaming(options: DailyLiveStreamingOptions): void;
564
685
  updateLiveStreaming(options: { layout?: DailyStreamingLayoutConfig }): void;
565
686
  stopLiveStreaming(): void;
687
+ startRemoteMediaPlayer(
688
+ options: DailyRemoteMediaPlayerStartOptions
689
+ ): Promise<DailyRemoteMediaPlayerInfo>;
690
+ stopRemoteMediaPlayer(session_id: string): Promise<void>;
691
+ updateRemoteMediaPlayer(
692
+ options: DailyRemoteMediaPlayerUpdateOptions
693
+ ): Promise<DailyRemoteMediaPlayerInfo>;
566
694
  preAuth(properties?: DailyCallOptions): Promise<{ access: DailyAccess }>;
567
695
  load(properties?: DailyLoadOptions): Promise<void>;
696
+ startRecording(options?: DailyStreamingOptions): void;
697
+ updateRecording(options: { layout?: DailyStreamingLayoutConfig }): void;
698
+ stopRecording(): void;
568
699
  getNetworkStats(): Promise<DailyNetworkStats>;
569
700
  subscribeToTracksAutomatically(): boolean;
570
701
  setSubscribeToTracksAutomatically(enabled: boolean): DailyCall;
702
+ enumerateDevices(): Promise<{ devices: MediaDeviceInfo[] }>;
571
703
  sendAppMessage(data: any, to?: string): DailyCall;
572
704
  setUserName(name: string): Promise<{ userName: string }>;
573
705
  room(options?: {