@livekit/react-native 1.1.1 → 1.1.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/README.md CHANGED
@@ -38,21 +38,16 @@ Once the `@livekit/react-native-webrtc` dependency is installed, one last step i
38
38
  In your [MainApplication.java](https://github.com/livekit/client-sdk-react-native/blob/main/example/android/app/src/main/java/com/example/livekitreactnative/MainApplication.java) file:
39
39
 
40
40
  ```
41
- import com.livekit.reactnative.video.SimulcastVideoEncoderFactoryWrapper;
42
- import com.oney.WebRTCModule.WebRTCModuleOptions;
43
- import com.oney.WebRTCModule.webrtcutils.H264AndSoftwareVideoDecoderFactory;
44
-
45
- import org.webrtc.*;
41
+ import com.livekit.reactnative.LiveKitReactNative;
46
42
 
47
43
  public class MainApplication extends Application implements ReactApplication {
48
44
 
49
45
  @Override
50
46
  public void onCreate() {
51
47
  // Place this above any other RN related initialization
52
- WebRTCModuleOptions options = WebRTCModuleOptions.getInstance();
53
- options.videoEncoderFactory = new SimulcastVideoEncoderFactoryWrapper(null, true, true);
54
- options.videoDecoderFactory = new H264AndSoftwareVideoDecoderFactory(null);
55
- // ...
48
+ LiveKitReactNative.setup();
49
+
50
+ //...
56
51
  }
57
52
  }
58
53
  ```
@@ -62,19 +57,15 @@ public class MainApplication extends Application implements ReactApplication {
62
57
  In your [AppDelegate.m](https://github.com/livekit/client-sdk-react-native/blob/main/example/ios/LivekitReactNativeExample/AppDelegate.mm) file:
63
58
 
64
59
  ```
65
- #import "WebRTCModule.h"
66
- #import "WebRTCModuleOptions.h"
60
+ #import "LivekitReactNative.h"
67
61
 
68
62
  @implementation AppDelegate
69
63
 
70
64
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
71
65
  {
72
66
  // Place this above any other RN related initialization
73
- RTCDefaultVideoEncoderFactory *videoEncoderFactory = [[RTCDefaultVideoEncoderFactory alloc] init];
74
- RTCVideoEncoderFactorySimulcast *simulcastVideoEncoderFactory =
75
- [[RTCVideoEncoderFactorySimulcast alloc] initWithPrimary:videoEncoderFactory fallback:videoEncoderFactory];
76
- WebRTCModuleOptions *options = [WebRTCModuleOptions sharedInstance];
77
- options.videoEncoderFactory = simulcastVideoEncoderFactory;
67
+ [LivekitReactNative setup];
68
+
78
69
  //...
79
70
  }
80
71
  ```
@@ -131,5 +131,6 @@ dependencies {
131
131
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
132
132
  api 'com.github.davidliu:audioswitch:c498d866c57f1d88056d5e7e7a78d622e3b0c046'
133
133
  api 'io.github.webrtc-sdk:android:104.5112.09'
134
+ implementation project(':livekit_react-native-webrtc')
134
135
  implementation "androidx.annotation:annotation:1.4.0"
135
136
  }
@@ -0,0 +1,16 @@
1
+ package com.livekit.reactnative
2
+
3
+ import com.livekit.reactnative.video.SimulcastVideoEncoderFactoryWrapper
4
+ import com.livekit.reactnative.video.WrappedVideoDecoderFactoryProxy
5
+ import com.oney.WebRTCModule.WebRTCModuleOptions
6
+
7
+
8
+ object LiveKitReactNative {
9
+
10
+ @JvmStatic
11
+ fun setup() {
12
+ val options = WebRTCModuleOptions.getInstance()
13
+ options.videoEncoderFactory = SimulcastVideoEncoderFactoryWrapper(null, true, true)
14
+ options.videoDecoderFactory = WrappedVideoDecoderFactoryProxy()
15
+ }
16
+ }
@@ -0,0 +1,19 @@
1
+ package com.livekit.reactnative.video
2
+
3
+ import com.oney.WebRTCModule.EglUtils
4
+ import org.webrtc.VideoCodecInfo
5
+ import org.webrtc.VideoDecoder
6
+ import org.webrtc.VideoDecoderFactory
7
+ import org.webrtc.WrappedVideoDecoderFactory
8
+
9
+ class WrappedVideoDecoderFactoryProxy : VideoDecoderFactory {
10
+
11
+ private val factory by lazy { WrappedVideoDecoderFactory(EglUtils.getRootEglBaseContext()) }
12
+ override fun createDecoder(codecInfo: VideoCodecInfo): VideoDecoder? {
13
+ return factory.createDecoder(codecInfo)
14
+ }
15
+
16
+ override fun getSupportedCodecs(): Array<VideoCodecInfo> {
17
+ return factory.supportedCodecs
18
+ }
19
+ }
@@ -8,4 +8,6 @@
8
8
 
9
9
  @interface LivekitReactNative : NSObject <RCTBridgeModule>
10
10
 
11
+ +(void)setup;
12
+
11
13
  @end
@@ -1,5 +1,7 @@
1
1
  #import <React/RCTBridgeModule.h>
2
2
  #import "LivekitReactNative.h"
3
+ #import "WebRTCModule.h"
4
+ #import "WebRTCModuleOptions.h"
3
5
  #import <WebRTC/RTCAudioSession.h>
4
6
  #import <WebRTC/RTCAudioSessionConfiguration.h>
5
7
  #import <AVFAudio/AVFAudio.h>
@@ -31,6 +33,13 @@ RCT_EXPORT_MODULE();
31
33
  return NO;
32
34
  }
33
35
 
36
+ +(void)setup {
37
+ RTCDefaultVideoEncoderFactory *videoEncoderFactory = [[RTCDefaultVideoEncoderFactory alloc] init];
38
+ RTCVideoEncoderFactorySimulcast *simulcastVideoEncoderFactory = [[RTCVideoEncoderFactorySimulcast alloc] initWithPrimary:videoEncoderFactory fallback:videoEncoderFactory];
39
+ WebRTCModuleOptions *options = [WebRTCModuleOptions sharedInstance];
40
+ options.videoEncoderFactory = simulcastVideoEncoderFactory;
41
+ }
42
+
34
43
  /// Configure default audio config for WebRTC
35
44
  RCT_EXPORT_METHOD(configureAudio:(NSDictionary *) config){
36
45
  NSDictionary *iOSConfig = [config objectForKey:@"ios"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livekit/react-native",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "LiveKit for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -15,10 +15,13 @@
15
15
  "cpp",
16
16
  "livekit-react-native.podspec",
17
17
  "!lib/typescript/example",
18
+ "!lib/typescript/ci",
18
19
  "!android/build",
19
20
  "!android/.gradle",
20
21
  "!android/.idea",
21
22
  "!ios/build",
23
+ "!example",
24
+ "!ci",
22
25
  "!**/__tests__",
23
26
  "!**/__fixtures__",
24
27
  "!**/__mocks__"
@@ -49,7 +52,7 @@
49
52
  "@babel/preset-env": "^7.20.0",
50
53
  "@babel/runtime": "^7.20.0",
51
54
  "@commitlint/config-conventional": "^16.2.1",
52
- "@livekit/react-native-webrtc": "^104.0.0-beta.0",
55
+ "@livekit/react-native-webrtc": "^104.0.1",
53
56
  "@react-native-community/eslint-config": "^3.2.0",
54
57
  "@release-it/conventional-changelog": "^4.2.0",
55
58
  "@tsconfig/react-native": "^2.0.2",
@@ -73,14 +76,14 @@
73
76
  "typescript": "4.8.4"
74
77
  },
75
78
  "peerDependencies": {
79
+ "@livekit/react-native-webrtc": "^104.0.1",
76
80
  "react": "*",
77
- "react-native": "*",
78
- "@livekit/react-native-webrtc": "^104.0.0"
81
+ "react-native": "*"
79
82
  },
80
83
  "scripts": {
81
84
  "test": "jest",
82
- "build-docs": "typedoc",
83
- "typescript": "tsc --noEmit",
85
+ "build-docs": "typedoc --tsconfig tsconfig.build.json",
86
+ "typescript": "tsc --noEmit -p tsconfig.build.json",
84
87
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
85
88
  "prepare": "bob build",
86
89
  "release": "release-it",
@@ -91,14 +94,35 @@
91
94
  "jest": {
92
95
  "preset": "react-native",
93
96
  "modulePathIgnorePatterns": [
94
- "<rootDir>/example/node_modules",
97
+ "<rootDir>/ci",
98
+ "<rootDir>/example",
95
99
  "<rootDir>/lib/"
96
100
  ]
97
101
  },
98
102
  "commitlint": {
99
103
  "extends": [
100
104
  "@commitlint/config-conventional"
101
- ]
105
+ ],
106
+ "rules": {
107
+ "type-enum": [
108
+ 2,
109
+ "always",
110
+ [
111
+ "build",
112
+ "chore",
113
+ "ci",
114
+ "docs",
115
+ "feat",
116
+ "fix",
117
+ "perf",
118
+ "refactor",
119
+ "revert",
120
+ "style",
121
+ "test",
122
+ "example"
123
+ ]
124
+ ]
125
+ }
102
126
  },
103
127
  "release-it": {
104
128
  "hooks": {
@@ -125,7 +149,8 @@
125
149
  },
126
150
  "plugins": {
127
151
  "@release-it/conventional-changelog": {
128
- "preset": "angular"
152
+ "preset": "angular",
153
+ "ignoreRecommendedBump": true
129
154
  }
130
155
  }
131
156
  },