@daily-co/react-native-daily-js 0.20.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).
@@ -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.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,17 +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.22.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
33
  "peerDependencies": {
34
- "@daily-co/react-native-webrtc": "1.89.2-daily.4",
34
+ "@daily-co/react-native-webrtc": "1.94.1-daily.2",
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": "1.89.2-daily.4",
39
+ "@daily-co/react-native-webrtc": "1.94.1-daily.2",
40
40
  "@react-native-async-storage/async-storage": "^1.15.7",
41
41
  "react-native-background-timer": "^2.3.1",
42
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;
@@ -337,6 +355,9 @@ export interface DailyEventObjectNoPayload {
337
355
  | 'loaded'
338
356
  | 'joining-meeting'
339
357
  | 'left-meeting'
358
+ | 'recording-stopped'
359
+ | 'recording-stats'
360
+ | 'recording-error'
340
361
  | 'live-streaming-started'
341
362
  | 'live-streaming-stopped'
342
363
  >;
@@ -351,6 +372,12 @@ export interface DailyEventObjectFatalError {
351
372
  };
352
373
  }
353
374
 
375
+ export interface DailyEventObjectNonFatalError {
376
+ action: Extract<DailyEvent, 'nonfatal-error'>;
377
+ type: DailyNonFatalErrorType;
378
+ errorMsg: string;
379
+ }
380
+
354
381
  export interface DailyEventObjectGenericError {
355
382
  action: Extract<
356
383
  DailyEvent,
@@ -392,6 +419,15 @@ export interface DailyEventObjectTrack {
392
419
  track: MediaStreamTrack;
393
420
  }
394
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
+
395
431
  export interface DailyEventObjectNetworkQualityEvent {
396
432
  action: Extract<DailyEvent, 'network-quality-change'>;
397
433
  threshold: string;
@@ -426,6 +462,28 @@ export interface DailyEventObjectReceiveSettingsUpdated {
426
462
  receiveSettings: DailyReceiveSettings;
427
463
  }
428
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
+
429
487
  export type DailyEventObject<
430
488
  T extends DailyEvent = any
431
489
  > = T extends DailyEventObjectAppMessage['action']
@@ -434,6 +492,8 @@ export type DailyEventObject<
434
492
  ? DailyEventObjectNoPayload
435
493
  : T extends DailyEventObjectFatalError['action']
436
494
  ? DailyEventObjectFatalError
495
+ : T extends DailyEventObjectNonFatalError['action']
496
+ ? DailyEventObjectNonFatalError
437
497
  : T extends DailyEventObjectGenericError['action']
438
498
  ? DailyEventObjectGenericError
439
499
  : T extends DailyEventObjectParticipants['action']
@@ -446,6 +506,12 @@ export type DailyEventObject<
446
506
  ? DailyEventObjectAccessState
447
507
  : T extends DailyEventObjectTrack['action']
448
508
  ? DailyEventObjectTrack
509
+ : T extends DailyEventObjectRecordingStarted['action']
510
+ ? DailyEventObjectRecordingStarted
511
+ : T extends DailyEventObjectRemoteMediaPlayerUpdate['action']
512
+ ? DailyEventObjectRemoteMediaPlayerUpdate
513
+ : T extends DailyEventObjectRemoteMediaPlayerStopped['action']
514
+ ? DailyEventObjectRemoteMediaPlayerStopped
449
515
  : T extends DailyEventObjectNetworkQualityEvent['action']
450
516
  ? DailyEventObjectNetworkQualityEvent
451
517
  : T extends DailyEventObjectNetworkConnectionEvent['action']
@@ -496,6 +562,20 @@ export type DailyStreamingLayoutConfig =
496
562
  | DailyStreamingActiveParticipantLayoutConfig
497
563
  | DailyStreamingPortraitLayoutConfig;
498
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
+
499
579
  export type DailyAccess = 'unknown' | SpecifiedDailyAccess;
500
580
 
501
581
  export type SpecifiedDailyAccess = { level: 'none' | 'lobby' | 'full' };
@@ -510,6 +590,51 @@ export type DailyAccessRequest = {
510
590
  name: string;
511
591
  };
512
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
+
513
638
  export interface DailyCall {
514
639
  join(properties?: DailyCallOptions): Promise<DailyParticipantsObject | void>;
515
640
  leave(): Promise<void>;
@@ -556,20 +681,25 @@ export interface DailyCall {
556
681
  setNativeInCallAudioMode(
557
682
  inCallAudioMode: DailyNativeInCallAudioMode
558
683
  ): DailyCall;
559
- startLiveStreaming(options: {
560
- rtmpUrl: string;
561
- width?: number;
562
- height?: number;
563
- backgroundColor?: string;
564
- layout?: DailyStreamingLayoutConfig;
565
- }): void;
684
+ startLiveStreaming(options: DailyLiveStreamingOptions): void;
566
685
  updateLiveStreaming(options: { layout?: DailyStreamingLayoutConfig }): void;
567
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>;
568
694
  preAuth(properties?: DailyCallOptions): Promise<{ access: DailyAccess }>;
569
695
  load(properties?: DailyLoadOptions): Promise<void>;
696
+ startRecording(options?: DailyStreamingOptions): void;
697
+ updateRecording(options: { layout?: DailyStreamingLayoutConfig }): void;
698
+ stopRecording(): void;
570
699
  getNetworkStats(): Promise<DailyNetworkStats>;
571
700
  subscribeToTracksAutomatically(): boolean;
572
701
  setSubscribeToTracksAutomatically(enabled: boolean): DailyCall;
702
+ enumerateDevices(): Promise<{ devices: MediaDeviceInfo[] }>;
573
703
  sendAppMessage(data: any, to?: string): DailyCall;
574
704
  setUserName(name: string): Promise<{ userName: string }>;
575
705
  room(options?: {