omikit-plugin 2.1.3 → 2.2.1

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
@@ -32,8 +32,9 @@ yarn add omikit-plugin --latest
32
32
  #### Android:
33
33
 
34
34
  - Add these settings in `build.gradle`:
35
+
35
36
  ```
36
- jcenter()
37
+ jcenter()
37
38
  maven {
38
39
  url("https://vihatgroup.jfrog.io/artifactory/omi-voice/")
39
40
  credentials {
@@ -42,10 +43,12 @@ maven {
42
43
  }
43
44
  }
44
45
  ```
46
+
45
47
  ```
46
48
  //in dependencies
47
49
  classpath 'com.google.gms:google-services:4.3.13'
48
50
  ```
51
+
49
52
  ```
50
53
  //under buildscript
51
54
  allprojects {
@@ -81,15 +84,16 @@ allprojects {
81
84
  You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blob/main/example/android/build.gradle">android/build.gradle</a> to know more informations.
82
85
 
83
86
  - Add these settings in `app/build.gradle`:
87
+
84
88
  ```
85
89
  apply plugin: 'com.android.application'
86
- apply plugin: 'kotlin-android'
87
90
  apply plugin: 'com.google.gms.google-services'
88
91
  ```
89
92
 
90
93
  You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blob/main/example/android/app/build.gradle">android/app/build.gradle</a> to know more informations.
91
94
 
92
95
  - Update AndroidManifest.xml:
96
+
93
97
  ```
94
98
  //need request this permission
95
99
  <uses-permission android:name="android.permission.INTERNET" />
@@ -99,18 +103,20 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
99
103
  <category android:name="android.intent.category.DEFAULT" />
100
104
  </intent-filter>
101
105
  //add this lines outside <activity>
102
- <service
103
- android:name="vn.vihat.omicall.omisdk.service.FMService"
104
- android:exported="false">
105
- <intent-filter>
106
- <action android:name="com.google.firebase.MESSAGING_EVENT" />
107
- </intent-filter>
108
- </service>
106
+ <receiver
107
+ android:name="vn.vihat.omicall.omisdk.receiver.FirebaseMessageReceiver"
108
+ android:exported="true"
109
+ android:permission="com.google.android.c2dm.permission.SEND">
110
+ <intent-filter>
111
+ <action android:name="com.google.android.c2dm.intent.RECEIVE" />
112
+ </intent-filter>
113
+ </receiver>
109
114
  ```
110
115
 
111
116
  You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blob/main/example/android/app/src/main/AndroidManifest.xml">AndroidManifest</a> to know more informations.
112
117
 
113
118
  - We registered permissions into my plugin:
119
+
114
120
  ```
115
121
  <uses-permission android:name="android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS"
116
122
  tools:ignore="ProtectedPermissions" />
@@ -131,13 +137,15 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
131
137
  ```
132
138
 
133
139
  - Setup remote push notification: Only support Firebase for remote push notification.
140
+
134
141
  - Add `google-service.json` in `android/app` (For more information, you can refer <a href="https://rnfirebase.io/app/usage">Core/App</a>)
135
142
  - Add Fire Messaging to receive `fcm_token` (You can refer <a href="https://rnfirebase.io/messaging/usage">Cloud Messaging</a> to setup notification for React native)
136
143
 
137
- - For more setting information, please refer <a href="https://rnfirebase.io/messaging/usage">Config Push for Android</a>
144
+ - For more setting information, please refer <a href="https://api.omicall.com/web-sdk/mobile-sdk/android-sdk/cau-hinh-push-notification">Config Push for Android</a>
138
145
 
139
146
  #### iOS:
140
- ----
147
+
148
+ ---
141
149
 
142
150
  We support both Object-C and Swift. But we only support documents for Object-C. We will write for Swift language later. Thank you.
143
151
 
@@ -150,11 +158,15 @@ We support both Object-C and Swift. But we only support documents for Object-C.
150
158
  #import <UserNotifications/UserNotifications.h>
151
159
  #import <OmiKit/OmiKit-umbrella.h>
152
160
  #import <OmiKit/Constants.h>
153
- #import <UserNotifications/UserNotifications.h>
154
161
 
155
- PushKitManager *pushkitManager;
156
- CallKitProviderDelegate * provider;
157
- PKPushRegistry * voipRegistry;
162
+ @interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate>
163
+
164
+ @property (nonatomic, strong) UIWindow *window;
165
+ @property (nonatomic, strong) PushKitManager *pushkitManager;
166
+ @property (nonatomic, strong) CallKitProviderDelegate * provider;
167
+ @property (nonatomic, strong) PKPushRegistry * voipRegistry;
168
+
169
+ @end
158
170
  ```
159
171
 
160
172
  - Edit AppDelegate.m:
@@ -167,9 +179,28 @@ PKPushRegistry * voipRegistry;
167
179
  provider = [[CallKitProviderDelegate alloc] initWithCallManager: [OMISIPLib sharedInstance].callManager];
168
180
  voipRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()];
169
181
  pushkitManager = [[PushKitManager alloc] initWithVoipRegistry:voipRegistry];
182
+ if (@available(iOS 10.0, *)) {
183
+ [UNUserNotificationCenter currentNotificationCenter].delegate = (id<UNUserNotificationCenterDelegate>) self;
184
+ }
185
+
186
+ //Called when a notification is delivered to a foreground app.
187
+ -(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
188
+ {
189
+ NSLog(@"User Info : %@",notification.request.content.userInfo);
190
+ completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge);
191
+ }
192
+
193
+ - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler {
194
+ NSDictionary *userInfo = response.notification.request.content.userInfo;
195
+ if (userInfo && [userInfo valueForKey:@"omisdkCallerNumber"]) {
196
+ NSLog(@"User Info : %@",userInfo);
197
+ [OmikitNotification didRecieve:userInfo];
198
+ }
199
+ completionHandler();
200
+ }
170
201
  ```
171
202
 
172
- - Add these lines into `Info.plist`:
203
+ - Add these lines into `Info.plist`:
173
204
 
174
205
  ```
175
206
  <key>NSMicrophoneUsageDescription</key>
@@ -191,15 +222,18 @@ pushkitManager = [[PushKitManager alloc] initWithVoipRegistry:voipRegistry];
191
222
  {
192
223
  [token appendFormat:@"%02.2hhX", data[i]];
193
224
  }
194
-
225
+
195
226
  // print the token in the console.
196
227
  NSLog(@"Push Notification Token: %@", [token copy]);
197
228
  [OmiClient setUserPushNotificationToken:[token copy]];
198
229
  }
199
230
 
200
231
  ```
201
- *** Only use under lines when added `Cloud Messaging` plugin in your project ***
232
+
233
+ **_ Only use under lines when added `Cloud Messaging` plugin in your project _**
234
+
202
235
  - Setup push notification: We only support Firebase for push notification.
236
+
203
237
  - Add `google-service.json` in `android/app` (For more information, you can refer <a href="https://rnfirebase.io/app/usage">Core/App</a>)
204
238
  - Add Firebase Messaging to receive `fcm_token` (You can refer <a href="https://pub.dev/packages/firebase_messaging">Cloud Messaging</a> to setup notification for React Native)
205
239
 
@@ -214,18 +248,23 @@ pushkitManager = [[PushKitManager alloc] initWithVoipRegistry:voipRegistry];
214
248
  //because we use APNS to push notification on iOS so you don't need add Firebase for iOS.
215
249
  //But you can use firebase-messaging to get APNS token for iOS.
216
250
  ```
251
+
217
252
  - Important function.
253
+
218
254
  - Start Serivce: OmiKit need start services and register some events.
255
+
219
256
  ```
220
257
  //Call in the root widget
221
258
  import { startServices } from 'omikit-plugin';
222
-
259
+
223
260
  startServices();
224
261
  ```
262
+
225
263
  - Create OmiKit With ApiKey: OmiKit need apikey, username, user id to init enviroment. ViHAT Group will provide api key for you. Please contact for my sale:
264
+
226
265
  ```
227
266
  import { initCallWithApiKey } from 'omikit-plugin';
228
-
267
+
229
268
  const loginInfo = {
230
269
  usrUuid: usrUuid,
231
270
  fullName: fullName,
@@ -236,10 +275,12 @@ pushkitManager = [[PushKitManager alloc] initWithVoipRegistry:voipRegistry];
236
275
  const result = await initCallWithApiKey(loginInfo);
237
276
  //result is true then user login successfully.
238
277
  ```
278
+
239
279
  - Create OmiKit: OmiKit need userName, password, realm, host to init enviroment. ViHAT Group will provide informations for you. Please contact for my sale:
280
+
240
281
  ```
241
282
  import { initCall } from 'omikit-plugin';
242
-
283
+
243
284
  const loginInfo = {
244
285
  userName: userName, //string
245
286
  password: password, //string
@@ -250,38 +291,45 @@ pushkitManager = [[PushKitManager alloc] initWithVoipRegistry:voipRegistry];
250
291
  const result = await initCall(loginInfo);
251
292
  //result is true then user login successfully.
252
293
  ```
253
- - Config push notification for Android:
254
- ```
255
- import { configPushNotification } from 'omikit-plugin';
256
-
257
- configPushNotification({
258
- prefix: 'Cuộc gọi tới từ: ',
259
- declineTitle: 'Từ chối',
260
- acceptTitle: 'Chấp nhận',
261
- acceptBackgroundColor: '#FF3700B3',
262
- declineBackgroundColor: '#FF000000',
263
- incomingBackgroundColor: '#FFFFFFFF',
264
- incomingAcceptButtonImage: 'join_call',
265
- incomingDeclineButtonImage: 'hangup',
266
- backImage: 'ic_back',
267
- userImage: 'calling_face',
268
- });
269
- //incomingAcceptButtonImage, incomingDeclineButtonImage, backImage, userImage: Add these into `android/app/src/main/res/drawble`
270
- ```
271
- - Get call when user open app from killed status(only iOS):
272
- ```
273
- import { getInitialCall } from 'omikit-plugin';
274
-
275
- const callingInfo = await getInitialCall();
276
- if (callingInfo !== false) {
277
- navigation.navigate('DialCall' as never, callingInfo as never);
278
- }
279
- //callingInfo != false then user have a calling.
280
- ```
294
+
295
+ - Config push notification:
296
+
297
+ ```
298
+ import { configPushNotification } from 'omikit-plugin';
299
+
300
+ configPushNotification({
301
+ prefix : "Cuộc gọi tới từ: ",
302
+ declineTitle : "Từ chối",
303
+ acceptTitle : "Chấp nhận",
304
+ acceptBackgroundColor : "#FF3700B3",
305
+ declineBackgroundColor : "#FF000000",
306
+ incomingBackgroundColor : "#FFFFFFFF",
307
+ incomingAcceptButtonImage : "join_call", //image name
308
+ incomingDeclineButtonImage : "hangup", //image name
309
+ backImage : "ic_back", //image name: icon of back button
310
+ userImage : "calling_face", //image name: icon of user default
311
+ prefixMissedCallMessage: 'Cuộc gọi nhỡ từ' //config prefix message for the missed call
312
+ missedCallTitle: 'Cuộc gọi nhỡ' //config title for the missed call
313
+ });
314
+ //incomingAcceptButtonImage, incomingDeclineButtonImage, backImage, userImage: Add these into `android/app/src/main/res/drawble`
315
+ ```
316
+
317
+ - Get call when user open app from killed status(only iOS):
318
+
319
+ ```
320
+ import { getInitialCall } from 'omikit-plugin';
321
+
322
+ const callingInfo = await getInitialCall();
323
+ if (callingInfo !== false) {
324
+ navigation.navigate('DialCall' as never, callingInfo as never);
325
+ }
326
+ //callingInfo != false then user have a calling.
327
+ ```
328
+
281
329
  - Upload token: OmiKit need FCM for Android and APNS to push notification on user devices. We use more packages: <a href="https://rnfirebase.io/messaging/usage">Cloud Messaging</a> and <a href="https://www.npmjs.com/package/react-native-device-info?activeTab=readme">react-native-device-info</a>
330
+
282
331
  ```
283
332
  import { updateToken } from 'omikit-plugin';
284
-
285
333
  const fcmToken = await fcm;
286
334
  const apnsToken = await apns;
287
335
  const deviceId = DeviceInfo.getDeviceId();
@@ -293,103 +341,179 @@ pushkitManager = [[PushKitManager alloc] initWithVoipRegistry:voipRegistry];
293
341
  appId: appId,
294
342
  });
295
343
  ```
344
+
296
345
  - Other functions:
297
- - Call with phone number (mobile phone or internal number):
298
- ```
299
- import {startCall} from 'omikit-plugin';
300
-
301
- const result = await startCall({
302
- phoneNumber: phone, //phone number
303
- isVideo: false //allow video call: true/false
304
- });
305
- ```
306
- - Call with UUID (only support with Api key):
307
- ```
308
- import {startCallWithUuid} from 'omikit-plugin';
309
-
310
- const result = await startCallWithUuid({
311
- usrUuid: uuid, //phone number
312
- isVideo: false //allow video call: true/false
313
- });
314
- ```
346
+
347
+ - Call with phone number (mobile phone or internal number):
348
+
349
+ ```
350
+ import {startCall} from 'omikit-plugin';
351
+ const result = await startCall({
352
+ phoneNumber: phone, //phone number
353
+ isVideo: false //allow video call: true/false
354
+ });
355
+ ```
356
+
357
+ - Call with UUID (only support with Api key):
358
+
359
+ ```
360
+ import {startCallWithUuid} from 'omikit-plugin';
361
+ const result = await startCallWithUuid({
362
+ usrUuid: uuid, //phone number
363
+ isVideo: false //allow video call: true/false
364
+ });
365
+ ```
366
+
315
367
  - Accept a call:
368
+
316
369
  ```
317
370
  import {joinCall} from 'omikit-plugin';
318
-
371
+
319
372
  await joinCall();
320
373
  ```
374
+
321
375
  - End a call: We will push a event `endCall` for you.
376
+
322
377
  ```
323
378
  import {endCall} from 'omikit-plugin';
324
-
325
- await endCall();
379
+
380
+ const value = await endCall();
381
+ //value is call information
382
+ Sample output:
383
+ {
384
+ "transaction_id":ea7dff38-cb1e-483d-8576...........,
385
+ "direction":"inbound",
386
+ "source_number":111,
387
+ "destination_number":110,
388
+ "time_start_to_answer":1682858097393,
389
+ "time_end":1682858152181,
390
+ "sip_user":111,
391
+ "disposition":"answered"
392
+ }
326
393
  ```
394
+
327
395
  - Toggle the audio: On/off audio a call
396
+
328
397
  ```
329
398
  import {toggleMute} from 'omikit-plugin';
330
-
399
+
331
400
  toggleMute();
332
401
  ```
402
+
333
403
  - Toggle the speaker: On/off the phone speaker
404
+
334
405
  ```
335
406
  import {toggleSpeaker} from 'omikit-plugin';
336
-
407
+
337
408
  toggleSpeaker();
338
409
  ```
410
+
339
411
  - Send character: We only support `1 to 9` and `* #`.
412
+
340
413
  ```
341
414
  import {sendDTMF} from 'omikit-plugin';
342
-
415
+
343
416
  sendDTMF({
344
417
  character: text,
345
418
  });
346
419
  ```
420
+
421
+ - Get current user information:
422
+ ```
423
+ final user = await getCurrentUser();
424
+ Output Sample:
425
+ {
426
+ "extension": "111",
427
+ "full_name": "chau1",
428
+ "avatar_url": "",
429
+ "uuid": "122aaa"
430
+ }
431
+ ```
432
+ - Get guest user information:
433
+ ```
434
+ final user = await getGuestUser();
435
+ Output Sample:
436
+ {
437
+ "extension": "111",
438
+ "full_name": "chau1",
439
+ "avatar_url": "",
440
+ "uuid": "122aaa"
441
+ }
442
+ ```
443
+ - Get user information from sip:
444
+
445
+ ```
446
+ final user = await getUserInfo("111");
447
+ Output Sample:
448
+ {
449
+ "extension": "111",
450
+ "full_name": "chau1",
451
+ "avatar_url": "",
452
+ "uuid": "122aaa"
453
+ }
454
+ ```
455
+
347
456
  - Logout: Can't receive call.
457
+
348
458
  ```
349
459
  import {logout} from 'omikit-plugin';
350
-
460
+
351
461
  logout();
352
462
  ```
353
-
463
+
354
464
  - Video Call functions: Support only video call, You need enable video in `init functions` and `start call` to implements under functions.
465
+
355
466
  - Switch front/back camera: We use the front camera for first time.
467
+
356
468
  ```
357
469
  import {switchOmiCamera} from 'omikit-plugin';
358
470
  switchOmiCamera();
359
471
  ```
472
+
360
473
  - Toggle a video in video call: On/off video in video call
474
+
361
475
  ```
362
476
  import {toggleOmiVideo} from 'omikit-plugin';
363
477
  toggleOmiVideo();
364
478
  ```
479
+
365
480
  - Local Camera Widget: Your camera view in a call
481
+
366
482
  ```
367
483
  import { OmiLocalCameraView } from 'omikit-plugin';
368
484
  <OmiLocalCameraView style={styles.localCamera} />
369
485
  ```
486
+
370
487
  - Remote Camera Widget: Remote camera view in a call
488
+
371
489
  ```
372
490
  import { OmiRemoteCameraView } from 'omikit-plugin';
373
491
  <OmiRemoteCameraView style={styles.remoteCamera} />
374
492
  ```
493
+
375
494
  - More function: Refresh local camera
495
+
376
496
  ```
377
497
  import {refreshLocalCamera} from 'omikit-plugin';
378
498
  refreshLocalCamera();
379
499
  ```
500
+
380
501
  - More function: Refresh remote camera
502
+
381
503
  ```
382
504
  import {refreshRemoteCamera} from 'omikit-plugin';
383
505
  refreshRemoteCamera();
384
506
  ```
507
+
385
508
  - Register event: Register remote video ready: only visible on iOS
509
+
386
510
  ```
387
511
  import {registerVideoEvent} from 'omikit-plugin';
388
512
  registerVideoEvent();
389
513
  ```
390
514
 
391
-
392
515
  - Event listener:
516
+
393
517
  ```
394
518
  useEffect(() => {
395
519
  omiEmitter.addListener(OmiCallEvent.incomingReceived, incomingReceived);
@@ -397,6 +521,7 @@ useEffect(() => {
397
521
  omiEmitter.addListener(OmiCallEvent.onCallEnd, onCallEnd);
398
522
  omiEmitter.addListener(OmiCallEvent.onMuted, onMuted);
399
523
  omiEmitter.addListener(OmiCallEvent.onSpeaker, onSpeaker);
524
+ omiEmitter.addListener(OmiCallEvent.onClickMissedCall, clickMissedCall);
400
525
  if (Platform.OS === 'ios') {
401
526
  registerVideoEvent();
402
527
  omiEmitter.addListener(
@@ -417,10 +542,12 @@ useEffect(() => {
417
542
  };
418
543
  }, []);
419
544
  ```
420
- - Action Name value:
421
- - `OmiCallEvent.incomingReceived`: Have a incoming call. On Android this event work only foreground
422
- - `OmiCallEvent.onCallEstablished`: Connected a call.
423
- - `OmiCallEvent.onCallEnd`: End a call.
424
- - `OmiCallEvent.onMuted`: Audio changed.
425
- - `OmiCallEvent.onSpeaker`: Audio changed.
545
+
546
+ - Action Name value:
547
+ - `OmiCallEvent.incomingReceived`: Have a incoming call. On Android this event work only foreground
548
+ - `OmiCallEvent.onCallEstablished`: Connected a call.
549
+ - `OmiCallEvent.onCallEnd`: End a call and return call information (like endCall)
550
+ - `OmiCallEvent.onMuted`: Audio changed.
551
+ - `OmiCallEvent.onSpeaker`: Audio changed.
552
+ - `OmiCallEvent.onClickMissedCall`: Click missed call notification.
426
553
  - Data value: We return `callerNumber`, `isVideo: true/false` information
@@ -96,7 +96,7 @@ dependencies {
96
96
  implementation "com.facebook.react:react-native:+" // From node_modules
97
97
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
98
98
 
99
- api 'vn.vihat.omicall:omi-sdk:1.1.0'
99
+ api 'vn.vihat.omicall:omi-sdk:1.1.24'
100
100
 
101
101
  implementation 'androidx.core:core-ktx:1.7.0'
102
102
  implementation 'androidx.fragment:fragment-ktx:1.4.0'
@@ -119,6 +119,7 @@ dependencies {
119
119
  implementation "com.squareup.okhttp3:okhttp:4.9.1"
120
120
  implementation "com.squareup.okhttp3:okhttp-urlconnection:4.9.1"
121
121
  implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
122
+ implementation "androidx.security:security-crypto:1.1.0-alpha06"
122
123
  }
123
124
 
124
125
  if (isNewArchitectureEnabled()) {
@@ -2,6 +2,7 @@ package com.omikitplugin
2
2
 
3
3
  import android.view.Surface
4
4
  import android.view.TextureView
5
+ import android.widget.LinearLayout
5
6
  import com.facebook.react.bridge.Promise
6
7
  import com.facebook.react.bridge.ReactApplicationContext
7
8
  import com.facebook.react.bridge.ReactContextBaseJavaModule
@@ -13,7 +14,8 @@ import vn.vihat.omicall.omisdk.videoutils.Size
13
14
  class FLLocalCameraModule(reactContext: ReactApplicationContext, localViewManager: FLLocalCameraView) :
14
15
  ReactContextBaseJavaModule(reactContext) {
15
16
 
16
- var cameraView: TextureView
17
+ var cameraView: LinearLayout
18
+ lateinit var localViewManager : FLLocalCameraView
17
19
 
18
20
  override fun getName(): String {
19
21
  return "FLLocalCameraView"
@@ -21,17 +23,12 @@ class FLLocalCameraModule(reactContext: ReactApplicationContext, localViewManage
21
23
 
22
24
  init {
23
25
  cameraView = localViewManager.localView
26
+ this.localViewManager = localViewManager
24
27
  }
25
28
 
26
29
  @ReactMethod
27
30
  fun refresh(promise: Promise) {
28
- cameraView.surfaceTexture?.let {
29
- OmiClient.instance.setupLocalVideoFeed(Surface(it))
30
- ScaleManager.adjustAspectRatio(cameraView,
31
- Size(cameraView.width, cameraView.height),
32
- Size(1280,720)
33
- )
34
- promise.resolve(true)
35
- }
31
+ this.localViewManager.refreshTexture()
32
+ promise.resolve(true)
36
33
  }
37
34
  }
@@ -1,23 +1,44 @@
1
1
  package com.omikitplugin
2
2
 
3
+ import android.view.Surface
3
4
  import android.view.TextureView
5
+ import android.widget.LinearLayout
4
6
  import com.facebook.react.bridge.ReactApplicationContext
5
7
  import com.facebook.react.uimanager.SimpleViewManager
6
8
  import com.facebook.react.uimanager.ThemedReactContext
9
+ import vn.vihat.omicall.omisdk.OmiClient
10
+ import vn.vihat.omicall.omisdk.videoutils.ScaleManager
11
+ import vn.vihat.omicall.omisdk.videoutils.Size
7
12
 
8
13
  class FLLocalCameraView(private val context: ReactApplicationContext) :
9
- SimpleViewManager<TextureView>() {
10
- val localView : TextureView = TextureView(context)
14
+ SimpleViewManager<LinearLayout>() {
15
+ val localView : LinearLayout = LinearLayout(context)
16
+ private val cameraView : TextureView = TextureView(context)
17
+
18
+ init {
19
+ localView.addView(cameraView)
20
+ }
11
21
 
12
22
  override fun getName(): String {
13
23
  return "FLLocalCameraView"
14
24
  }
15
25
 
16
- override fun createViewInstance(p0: ThemedReactContext): TextureView {
26
+ override fun createViewInstance(p0: ThemedReactContext): LinearLayout {
17
27
  return localView
18
28
  }
19
29
 
20
- fun localViewInstance(): TextureView {
30
+ fun localViewInstance(): LinearLayout {
21
31
  return localView
22
32
  }
33
+
34
+ fun refreshTexture() {
35
+ cameraView.surfaceTexture?.let {
36
+ OmiClient.instance.setupLocalVideoFeed(Surface(it))
37
+ ScaleManager.adjustAspectRatio(
38
+ cameraView,
39
+ Size(cameraView.width, cameraView.height),
40
+ Size(1280, 720)
41
+ )
42
+ }
43
+ }
23
44
  }