react-native-altibbi 0.2.0 → 0.3.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/android/build.gradle +1 -1
- package/android/src/main/java/com/altibbi/OTPublisherLayout.java +2 -1
- package/android/src/main/java/com/altibbi/OTPublisherViewManager.java +2 -1
- package/android/src/main/java/com/altibbi/OTRN.java +2 -1
- package/android/src/main/java/com/altibbi/OTScreenCapturer.java +1 -0
- package/android/src/main/java/com/altibbi/OTSessionManager.java +91 -33
- package/android/src/main/java/com/altibbi/OTSubscriberLayout.java +0 -1
- package/android/src/main/java/com/altibbi/OTSubscriberViewManager.java +2 -1
- package/android/src/main/java/com/altibbi/utils/EventUtils.java +1 -1
- package/android/src/main/java/com/altibbi/utils/Utils.java +8 -11
- package/ios/OTSessionManager.m +7 -4
- package/ios/OTSessionManager.swift +156 -80
- package/ios/Utils/EventUtils.swift +51 -12
- package/ios/Utils/Utils.swift +21 -12
- package/lib/commonjs/connection.js +100 -5
- package/lib/commonjs/connection.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/scoket.js.map +1 -1
- package/lib/commonjs/video/OT.d.js +3 -0
- package/lib/commonjs/video/OT.d.js.map +1 -1
- package/lib/commonjs/video/OT.js +3 -2
- package/lib/commonjs/video/OT.js.map +1 -1
- package/lib/commonjs/video/OTError.js.map +1 -1
- package/lib/commonjs/video/OTPublisher.d.js +2 -2
- package/lib/commonjs/video/OTPublisher.d.js.map +1 -1
- package/lib/commonjs/video/OTPublisher.js +27 -7
- package/lib/commonjs/video/OTPublisher.js.map +1 -1
- package/lib/commonjs/video/OTSession.d.js +2 -1
- package/lib/commonjs/video/OTSession.d.js.map +1 -1
- package/lib/commonjs/video/OTSession.js +25 -5
- package/lib/commonjs/video/OTSession.js.map +1 -1
- package/lib/commonjs/video/OTSubscriber.d.js +2 -2
- package/lib/commonjs/video/OTSubscriber.d.js.map +1 -1
- package/lib/commonjs/video/OTSubscriber.js +20 -4
- package/lib/commonjs/video/OTSubscriber.js.map +1 -1
- package/lib/commonjs/video/contexts/OTContext.js +1 -1
- package/lib/commonjs/video/contexts/OTContext.js.map +1 -1
- package/lib/commonjs/video/helpers/OTHelper.js +2 -2
- package/lib/commonjs/video/helpers/OTHelper.js.map +1 -1
- package/lib/commonjs/video/helpers/OTPublisherHelper.js +47 -8
- package/lib/commonjs/video/helpers/OTPublisherHelper.js.map +1 -1
- package/lib/commonjs/video/helpers/OTSessionHelper.js +7 -1
- package/lib/commonjs/video/helpers/OTSessionHelper.js.map +1 -1
- package/lib/commonjs/video/helpers/OTSubscriberHelper.js +1 -1
- package/lib/commonjs/video/index.d.js +1 -1
- package/lib/commonjs/video/index.d.js.map +1 -1
- package/lib/commonjs/video/index.js +1 -1
- package/lib/commonjs/video/index.js.map +1 -1
- package/lib/module/connection.js +91 -3
- package/lib/module/connection.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/scoket.js.map +1 -1
- package/lib/module/video/OT.d.js +2 -1
- package/lib/module/video/OT.d.js.map +1 -1
- package/lib/module/video/OT.js +3 -2
- package/lib/module/video/OT.js.map +1 -1
- package/lib/module/video/OTError.js.map +1 -1
- package/lib/module/video/OTPublisher.d.js +1 -1
- package/lib/module/video/OTPublisher.d.js.map +1 -1
- package/lib/module/video/OTPublisher.js +26 -6
- package/lib/module/video/OTPublisher.js.map +1 -1
- package/lib/module/video/OTSession.d.js +1 -1
- package/lib/module/video/OTSession.d.js.map +1 -1
- package/lib/module/video/OTSession.js +25 -5
- package/lib/module/video/OTSession.js.map +1 -1
- package/lib/module/video/OTSubscriber.d.js +1 -1
- package/lib/module/video/OTSubscriber.d.js.map +1 -1
- package/lib/module/video/OTSubscriber.js +19 -3
- package/lib/module/video/OTSubscriber.js.map +1 -1
- package/lib/module/video/helpers/OTHelper.js +1 -1
- package/lib/module/video/helpers/OTHelper.js.map +1 -1
- package/lib/module/video/helpers/OTPublisherHelper.js +47 -8
- package/lib/module/video/helpers/OTPublisherHelper.js.map +1 -1
- package/lib/module/video/helpers/OTSessionHelper.js +6 -1
- package/lib/module/video/helpers/OTSessionHelper.js.map +1 -1
- package/lib/module/video/helpers/OTSubscriberHelper.js +1 -1
- package/lib/typescript/src/connection.d.ts +11 -3
- package/lib/typescript/src/connection.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +55 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/video/OT.d.ts +1 -1
- package/lib/typescript/src/video/OT.d.ts.map +1 -1
- package/lib/typescript/src/video/OTPublisher.d.ts +7 -1
- package/lib/typescript/src/video/OTPublisher.d.ts.map +1 -1
- package/lib/typescript/src/video/OTSession.d.ts +3 -1
- package/lib/typescript/src/video/OTSession.d.ts.map +1 -1
- package/lib/typescript/src/video/OTSubscriber.d.ts +7 -1
- package/lib/typescript/src/video/OTSubscriber.d.ts.map +1 -1
- package/lib/typescript/src/video/helpers/OTPublisherHelper.d.ts +2 -1
- package/lib/typescript/src/video/helpers/OTPublisherHelper.d.ts.map +1 -1
- package/lib/typescript/src/video/helpers/OTSessionHelper.d.ts +1 -0
- package/lib/typescript/src/video/helpers/OTSessionHelper.d.ts.map +1 -1
- package/lib/typescript/src/video/views/OTPublisherView.d.ts.map +1 -1
- package/lib/typescript/src/video/views/OTSubscriberView.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-altibbi.podspec +2 -2
- package/src/connection.ts +122 -5
- package/src/index.tsx +2 -0
- package/src/types.ts +62 -2
- package/src/video/OT.d.ts +5 -14
- package/src/video/OT.js +6 -4
- package/src/video/OTPublisher.d.ts +16 -10
- package/src/video/OTPublisher.js +37 -5
- package/src/video/OTSession.d.ts +42 -41
- package/src/video/OTSession.js +23 -4
- package/src/video/OTSubscriber.d.ts +12 -6
- package/src/video/OTSubscriber.js +25 -3
- package/src/video/helpers/OTHelper.js +1 -1
- package/src/video/helpers/OTPublisherHelper.js +56 -6
- package/src/video/helpers/OTSessionHelper.js +7 -0
- package/src/video/helpers/OTSubscriberHelper.js +1 -1
- package/android/src/main/java/com/altibbi/OTCustomAudioDevice.java +0 -1146
package/android/build.gradle
CHANGED
|
@@ -99,6 +99,6 @@ dependencies {
|
|
|
99
99
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
100
100
|
implementation 'com.pusher:pusher-java-client:2.+'
|
|
101
101
|
implementation 'com.google.code.gson:gson:2.+'
|
|
102
|
-
implementation 'com.opentok.android:opentok-android-sdk:2.
|
|
102
|
+
implementation 'com.opentok.android:opentok-android-sdk:2.28.0'
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
package com.altibbi;
|
|
2
2
|
|
|
3
|
-
import android.
|
|
3
|
+
import android.view.Gravity;
|
|
4
4
|
import android.widget.FrameLayout;
|
|
5
|
+
import android.opengl.GLSurfaceView;
|
|
5
6
|
|
|
6
7
|
import com.facebook.react.uimanager.ThemedReactContext;
|
|
7
8
|
import com.opentok.android.BaseVideoRenderer;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
package com.altibbi;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
import android.util.Log;
|
|
4
5
|
|
|
5
|
-
import com.facebook.react.uimanager.ThemedReactContext;
|
|
6
6
|
import com.facebook.react.uimanager.ViewGroupManager;
|
|
7
|
+
import com.facebook.react.uimanager.ThemedReactContext;
|
|
7
8
|
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
8
9
|
|
|
9
10
|
|
|
@@ -2,7 +2,6 @@ package com.altibbi;
|
|
|
2
2
|
|
|
3
3
|
import android.widget.FrameLayout;
|
|
4
4
|
|
|
5
|
-
import com.facebook.react.bridge.Callback;
|
|
6
5
|
import com.opentok.android.Connection;
|
|
7
6
|
import com.opentok.android.Publisher;
|
|
8
7
|
import com.opentok.android.Session;
|
|
@@ -11,6 +10,8 @@ import com.opentok.android.Subscriber;
|
|
|
11
10
|
|
|
12
11
|
import java.util.concurrent.ConcurrentHashMap;
|
|
13
12
|
|
|
13
|
+
import com.facebook.react.bridge.Callback;
|
|
14
|
+
|
|
14
15
|
|
|
15
16
|
public class OTRN {
|
|
16
17
|
|
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
package com.altibbi;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
import android.os.Build;
|
|
5
5
|
import android.util.Log;
|
|
6
|
-
import android.view.View;
|
|
7
6
|
import android.widget.FrameLayout;
|
|
7
|
+
import android.view.View;
|
|
8
8
|
|
|
9
9
|
import androidx.annotation.Nullable;
|
|
10
10
|
|
|
11
|
+
import com.altibbi.utils.EventUtils;
|
|
12
|
+
import com.altibbi.utils.Utils;
|
|
11
13
|
import com.facebook.react.bridge.Arguments;
|
|
12
14
|
import com.facebook.react.bridge.Callback;
|
|
13
15
|
import com.facebook.react.bridge.LifecycleEventListener;
|
|
14
|
-
import com.facebook.react.bridge.Promise;
|
|
15
16
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
16
17
|
import com.facebook.react.bridge.ReactContext;
|
|
17
18
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
19
|
import com.facebook.react.bridge.ReactMethod;
|
|
19
|
-
import com.facebook.react.bridge.ReadableArray;
|
|
20
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
21
20
|
import com.facebook.react.bridge.UiThreadUtil;
|
|
22
21
|
import com.facebook.react.bridge.WritableArray;
|
|
23
22
|
import com.facebook.react.bridge.WritableMap;
|
|
24
23
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
25
|
-
import com.
|
|
24
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
25
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
26
|
+
import com.facebook.react.bridge.Promise;
|
|
27
|
+
|
|
28
|
+
import com.opentok.android.Session;
|
|
26
29
|
import com.opentok.android.Connection;
|
|
27
30
|
import com.opentok.android.MediaUtils;
|
|
28
31
|
import com.opentok.android.MuteForcedInfo;
|
|
29
|
-
import com.opentok.android.OpentokError;
|
|
30
32
|
import com.opentok.android.Publisher;
|
|
31
33
|
import com.opentok.android.PublisherKit;
|
|
32
34
|
import com.opentok.android.PublisherKit.VideoTransformer;
|
|
33
|
-
import com.opentok.android.Session;
|
|
34
|
-
import com.opentok.android.Session.Builder.IceServer;
|
|
35
|
-
import com.opentok.android.Session.Builder.IncludeServers;
|
|
36
|
-
import com.opentok.android.Session.Builder.TransportPolicy;
|
|
37
35
|
import com.opentok.android.Stream;
|
|
36
|
+
import com.opentok.android.OpentokError;
|
|
38
37
|
import com.opentok.android.Subscriber;
|
|
39
38
|
import com.opentok.android.SubscriberKit;
|
|
40
39
|
import com.opentok.android.VideoUtils;
|
|
41
|
-
import com.
|
|
42
|
-
import com.
|
|
40
|
+
import com.opentok.android.Session.Builder.TransportPolicy;
|
|
41
|
+
import com.opentok.android.Session.Builder.IncludeServers;
|
|
42
|
+
import com.opentok.android.Session.Builder.IceServer;
|
|
43
|
+
import com.opentok.android.AudioDeviceManager;
|
|
43
44
|
|
|
44
|
-
import java.util.ArrayList;
|
|
45
45
|
import java.util.List;
|
|
46
46
|
import java.util.concurrent.ConcurrentHashMap;
|
|
47
|
+
import java.util.ArrayList;
|
|
47
48
|
|
|
48
49
|
public class OTSessionManager extends ReactContextBaseJavaModule
|
|
49
50
|
implements Session.SessionListener,
|
|
@@ -53,6 +54,7 @@ public class OTSessionManager extends ReactContextBaseJavaModule
|
|
|
53
54
|
PublisherKit.AudioStatsListener,
|
|
54
55
|
PublisherKit.MuteListener,
|
|
55
56
|
PublisherKit.VideoStatsListener,
|
|
57
|
+
PublisherKit.VideoListener,
|
|
56
58
|
SubscriberKit.SubscriberListener,
|
|
57
59
|
Session.SignalListener,
|
|
58
60
|
Session.ConnectionListener,
|
|
@@ -94,11 +96,6 @@ public class OTSessionManager extends ReactContextBaseJavaModule
|
|
|
94
96
|
final boolean useTextureViews = sessionOptions.getBoolean("useTextureViews");
|
|
95
97
|
final boolean connectionEventsSuppressed = sessionOptions.getBoolean("connectionEventsSuppressed");
|
|
96
98
|
final boolean ipWhitelist = sessionOptions.getBoolean("ipWhitelist");
|
|
97
|
-
final boolean enableStereoOutput = sessionOptions.getBoolean("enableStereoOutput");
|
|
98
|
-
if (enableStereoOutput) {
|
|
99
|
-
OTCustomAudioDriver otCustomAudioDriver = new OTCustomAudioDriver(this.getReactApplicationContext());
|
|
100
|
-
AudioDeviceManager.setAudioDevice(otCustomAudioDriver);
|
|
101
|
-
}
|
|
102
99
|
final List<IceServer> iceServersList = Utils.sanitizeIceServer(sessionOptions.getArray("customServers"));
|
|
103
100
|
final IncludeServers includeServers = Utils.sanitizeIncludeServer(sessionOptions.getString("includeServers"));
|
|
104
101
|
final TransportPolicy transportPolicy = Utils.sanitizeTransportPolicy(sessionOptions.getString("transportPolicy"));
|
|
@@ -156,7 +153,8 @@ public class OTSessionManager extends ReactContextBaseJavaModule
|
|
|
156
153
|
Boolean videoTrack = properties.getBoolean("videoTrack");
|
|
157
154
|
Boolean audioTrack = properties.getBoolean("audioTrack");
|
|
158
155
|
String cameraPosition = properties.getString("cameraPosition");
|
|
159
|
-
Boolean
|
|
156
|
+
Boolean publisherAudioFallback = properties.getBoolean("publisherAudioFallback");
|
|
157
|
+
Boolean subscriberAudioFallback = properties.getBoolean("subscriberAudioFallback");
|
|
160
158
|
int audioBitrate = properties.getInt("audioBitrate");
|
|
161
159
|
Boolean enableDtx = properties.getBoolean("enableDtx");
|
|
162
160
|
String frameRate = "FPS_" + properties.getInt("frameRate");
|
|
@@ -188,25 +186,28 @@ public class OTSessionManager extends ReactContextBaseJavaModule
|
|
|
188
186
|
.videoTrack(videoTrack)
|
|
189
187
|
.name(name)
|
|
190
188
|
.audioBitrate(audioBitrate)
|
|
189
|
+
.publisherAudioFallbackEnabled(publisherAudioFallback)
|
|
190
|
+
.subscriberAudioFallbackEnabled(subscriberAudioFallback)
|
|
191
191
|
.resolution(Publisher.CameraCaptureResolution.valueOf(resolution))
|
|
192
192
|
.frameRate(Publisher.CameraCaptureFrameRate.valueOf(frameRate))
|
|
193
193
|
.build();
|
|
194
|
+
|
|
194
195
|
if (cameraPosition.equals("back")) {
|
|
195
196
|
mPublisher.cycleCamera();
|
|
196
197
|
}
|
|
197
|
-
if (mPublisher.getCapturer() != null) {
|
|
198
|
+
if (videoTrack && mPublisher.getCapturer() != null) {
|
|
198
199
|
mPublisher.getCapturer().setVideoContentHint(Utils.convertVideoContentHint(properties.getString("videoContentHint")));
|
|
199
200
|
}
|
|
200
201
|
}
|
|
201
202
|
mPublisher.setPublisherListener(this);
|
|
202
203
|
mPublisher.setAudioLevelListener(this);
|
|
203
204
|
mPublisher.setRtcStatsReportListener(this);
|
|
204
|
-
mPublisher.setAudioFallbackEnabled(audioFallbackEnabled);
|
|
205
205
|
mPublisher.setPublishVideo(publishVideo);
|
|
206
206
|
mPublisher.setPublishAudio(publishAudio);
|
|
207
207
|
mPublisher.setPublishCaptions(publishCaptions);
|
|
208
208
|
mPublisher.setAudioStatsListener(this);
|
|
209
209
|
mPublisher.setVideoStatsListener(this);
|
|
210
|
+
mPublisher.setVideoListener(this);
|
|
210
211
|
mPublisher.setMuteListener(this);
|
|
211
212
|
ConcurrentHashMap<String, Publisher> mPublishers = sharedState.getPublishers();
|
|
212
213
|
mPublishers.put(publisherId, mPublisher);
|
|
@@ -330,7 +331,7 @@ public class OTSessionManager extends ReactContextBaseJavaModule
|
|
|
330
331
|
Stream mStream = streams.get(streamId);
|
|
331
332
|
if (mStream == null) {
|
|
332
333
|
promise.reject("Stream not found.");
|
|
333
|
-
|
|
334
|
+
continue;
|
|
334
335
|
}
|
|
335
336
|
mExcludedStreams.add(mStream);
|
|
336
337
|
}
|
|
@@ -486,11 +487,11 @@ public class OTSessionManager extends ReactContextBaseJavaModule
|
|
|
486
487
|
}
|
|
487
488
|
|
|
488
489
|
@ReactMethod
|
|
489
|
-
public void getSubscriberRtcStatsReport(
|
|
490
|
+
public void getSubscriberRtcStatsReport() {
|
|
490
491
|
|
|
491
492
|
ConcurrentHashMap<String, Subscriber> mSubscribers = sharedState.getSubscribers();
|
|
492
|
-
Subscriber
|
|
493
|
-
|
|
493
|
+
ArrayList<Subscriber> mSubscriberList = new ArrayList<>(mSubscribers.values());
|
|
494
|
+
for (Subscriber mSubscriber : mSubscriberList) {
|
|
494
495
|
mSubscriber.getRtcStatsReport();
|
|
495
496
|
}
|
|
496
497
|
}
|
|
@@ -590,6 +591,19 @@ public class OTSessionManager extends ReactContextBaseJavaModule
|
|
|
590
591
|
|
|
591
592
|
}
|
|
592
593
|
|
|
594
|
+
@ReactMethod
|
|
595
|
+
public void setEncryptionSecret(String sessionId, String secret, Callback callback) {
|
|
596
|
+
ConcurrentHashMap<String, Session> mSessions = sharedState.getSessions();
|
|
597
|
+
Session mSession = mSessions.get(sessionId);
|
|
598
|
+
if (mSession != null) {
|
|
599
|
+
mSession.setEncryptionSecret(secret);
|
|
600
|
+
callback.invoke();
|
|
601
|
+
} else {
|
|
602
|
+
WritableMap errorInfo = EventUtils.createError("There was an error setting the encryption secret. The native session instance could not be found.");
|
|
603
|
+
callback.invoke(errorInfo);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
593
607
|
@ReactMethod
|
|
594
608
|
public void destroyPublisher(final String publisherId, final Callback callback) {
|
|
595
609
|
|
|
@@ -844,14 +858,14 @@ public class OTSessionManager extends ReactContextBaseJavaModule
|
|
|
844
858
|
printLogs("onStreamDropped: Stream Dropped: "+stream.getStreamId() +" in session: "+session.getSessionId());
|
|
845
859
|
}
|
|
846
860
|
@Override
|
|
847
|
-
public void onMuteForced
|
|
861
|
+
public void onMuteForced(Session session, MuteForcedInfo info) {
|
|
848
862
|
|
|
849
863
|
WritableMap muteForcedInfo = Arguments.createMap();
|
|
850
864
|
String sessionId = session.getSessionId();
|
|
851
865
|
muteForcedInfo.putString("sessionId", sessionId);
|
|
852
866
|
Boolean active = info.getActive();
|
|
853
867
|
muteForcedInfo.putBoolean("active", active);
|
|
854
|
-
sendEventMap(this.getReactApplicationContext(), session.getSessionId() + ":" + sessionPreface + "onMuteForced
|
|
868
|
+
sendEventMap(this.getReactApplicationContext(), session.getSessionId() + ":" + sessionPreface + "onMuteForced", muteForcedInfo);
|
|
855
869
|
printLogs("Mute forced -- active: " + active + " in session: " + sessionId);
|
|
856
870
|
}
|
|
857
871
|
|
|
@@ -862,9 +876,9 @@ public class OTSessionManager extends ReactContextBaseJavaModule
|
|
|
862
876
|
ConcurrentHashMap<String, Stream> mSubscriberStreams = sharedState.getSubscriberStreams();
|
|
863
877
|
mSubscriberStreams.put(stream.getStreamId(), stream);
|
|
864
878
|
if (publisherId.length() > 0) {
|
|
865
|
-
String event = publisherId + ":" + publisherPreface + "onStreamCreated";;
|
|
866
879
|
WritableMap streamInfo = EventUtils.prepareJSStreamMap(stream, publisherKit.getSession());
|
|
867
|
-
|
|
880
|
+
streamInfo.putString("publisherId", publisherId);
|
|
881
|
+
sendEventMap(this.getReactApplicationContext(), "publisherStreamCreated", streamInfo);
|
|
868
882
|
}
|
|
869
883
|
printLogs("onStreamCreated: Publisher Stream Created. Own stream "+stream.getStreamId());
|
|
870
884
|
|
|
@@ -874,13 +888,13 @@ public class OTSessionManager extends ReactContextBaseJavaModule
|
|
|
874
888
|
public void onStreamDestroyed(PublisherKit publisherKit, Stream stream) {
|
|
875
889
|
|
|
876
890
|
String publisherId = Utils.getPublisherId(publisherKit);
|
|
877
|
-
String event = publisherId + ":" + publisherPreface + "onStreamDestroyed";
|
|
878
891
|
ConcurrentHashMap<String, Stream> mSubscriberStreams = sharedState.getSubscriberStreams();
|
|
879
892
|
String mStreamId = stream.getStreamId();
|
|
880
893
|
mSubscriberStreams.remove(mStreamId);
|
|
881
894
|
if (publisherId.length() > 0) {
|
|
882
895
|
WritableMap streamInfo = EventUtils.prepareJSStreamMap(stream, publisherKit.getSession());
|
|
883
|
-
|
|
896
|
+
streamInfo.putString("publisherId", publisherId);
|
|
897
|
+
sendEventMap(this.getReactApplicationContext(), "publisherStreamDestroyed", streamInfo);
|
|
884
898
|
}
|
|
885
899
|
Callback mCallback = sharedState.getPublisherDestroyedCallbacks().get(publisherId);
|
|
886
900
|
if (mCallback != null) {
|
|
@@ -947,7 +961,7 @@ public class OTSessionManager extends ReactContextBaseJavaModule
|
|
|
947
961
|
}
|
|
948
962
|
|
|
949
963
|
@Override
|
|
950
|
-
public void onMuteForced
|
|
964
|
+
public void onMuteForced(PublisherKit publisher) {
|
|
951
965
|
|
|
952
966
|
String publisherId = Utils.getPublisherId(publisher);
|
|
953
967
|
if (publisherId.length() > 0) {
|
|
@@ -956,6 +970,50 @@ public class OTSessionManager extends ReactContextBaseJavaModule
|
|
|
956
970
|
}
|
|
957
971
|
}
|
|
958
972
|
|
|
973
|
+
@Override
|
|
974
|
+
public void onVideoDisabled(PublisherKit publisher, String reason) {
|
|
975
|
+
String publisherId = Utils.getPublisherId(publisher);
|
|
976
|
+
if (publisherId.length() > 0) {
|
|
977
|
+
String event = publisherId + ":" + publisherPreface + "onVideoDisabled";
|
|
978
|
+
WritableMap publisherInfo = Arguments.createMap();
|
|
979
|
+
publisherInfo.putString("reason", reason);
|
|
980
|
+
sendEventMap(this.getReactApplicationContext(), event, publisherInfo);
|
|
981
|
+
}
|
|
982
|
+
printLogs("Publisher onVideoDisabled " + reason);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
@Override
|
|
986
|
+
public void onVideoEnabled(PublisherKit publisher, String reason) {
|
|
987
|
+
String publisherId = Utils.getPublisherId(publisher);
|
|
988
|
+
if (publisherId.length() > 0) {
|
|
989
|
+
String event = publisherId + ":" + publisherPreface + "onVideoEnabled";
|
|
990
|
+
WritableMap publisherInfo = Arguments.createMap();
|
|
991
|
+
publisherInfo.putString("reason", reason);
|
|
992
|
+
sendEventMap(this.getReactApplicationContext(), event, publisherInfo);
|
|
993
|
+
}
|
|
994
|
+
printLogs("Publisher onVideoEnabled " + reason);
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
@Override
|
|
998
|
+
public void onVideoDisableWarning(PublisherKit publisher) {
|
|
999
|
+
String publisherId = Utils.getPublisherId(publisher);
|
|
1000
|
+
if (publisherId.length() > 0) {
|
|
1001
|
+
String event = publisherId + ":" + publisherPreface + "onVideoDisableWarning";
|
|
1002
|
+
sendEventMap(this.getReactApplicationContext(), event, null);
|
|
1003
|
+
}
|
|
1004
|
+
printLogs("Publisher onVideoDisableWarning");
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
@Override
|
|
1008
|
+
public void onVideoDisableWarningLifted(PublisherKit publisher) {
|
|
1009
|
+
String publisherId = Utils.getPublisherId(publisher);
|
|
1010
|
+
if (publisherId.length() > 0) {
|
|
1011
|
+
String event = publisherId + ":" + publisherPreface + "onVideoDisableWarningLifted";
|
|
1012
|
+
sendEventMap(this.getReactApplicationContext(), event, null);
|
|
1013
|
+
}
|
|
1014
|
+
printLogs("Publisher onVideoDisableWarningLifted");
|
|
1015
|
+
}
|
|
1016
|
+
|
|
959
1017
|
@Override
|
|
960
1018
|
public void onConnected(SubscriberKit subscriberKit) {
|
|
961
1019
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
package com.altibbi;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import com.facebook.react.uimanager.ThemedReactContext;
|
|
5
4
|
import com.facebook.react.uimanager.ViewGroupManager;
|
|
5
|
+
import com.facebook.react.uimanager.ThemedReactContext;
|
|
6
6
|
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
7
|
+
import android.util.Log;
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
public class OTSubscriberViewManager extends ViewGroupManager<OTSubscriberLayout> {
|
|
@@ -6,10 +6,10 @@ import com.facebook.react.bridge.WritableMap;
|
|
|
6
6
|
import com.opentok.android.Connection;
|
|
7
7
|
import com.opentok.android.MediaUtils;
|
|
8
8
|
import com.opentok.android.OpentokError;
|
|
9
|
-
import com.opentok.android.PublisherKit;
|
|
10
9
|
import com.opentok.android.Session;
|
|
11
10
|
import com.opentok.android.Stream;
|
|
12
11
|
import com.opentok.android.SubscriberKit;
|
|
12
|
+
import com.opentok.android.PublisherKit;
|
|
13
13
|
|
|
14
14
|
public final class EventUtils {
|
|
15
15
|
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
package com.altibbi.utils;
|
|
2
2
|
|
|
3
|
-
import com.
|
|
4
|
-
import com.opentok.android.BaseVideoCapturer.VideoContentHint;
|
|
3
|
+
import com.altibbi.OTRN;
|
|
5
4
|
import com.opentok.android.OpentokError;
|
|
6
5
|
import com.opentok.android.Publisher;
|
|
7
6
|
import com.opentok.android.PublisherKit;
|
|
8
7
|
import com.opentok.android.PublisherKit.VideoTransformer;
|
|
9
|
-
import com.opentok.android.Session.Builder.IceServer;
|
|
10
|
-
import com.opentok.android.Session.Builder.IncludeServers;
|
|
11
|
-
import com.opentok.android.Session.Builder.TransportPolicy;
|
|
12
8
|
import com.opentok.android.Subscriber;
|
|
13
9
|
import com.opentok.android.SubscriberKit;
|
|
14
|
-
import com.
|
|
10
|
+
import com.opentok.android.Session.Builder.TransportPolicy;
|
|
11
|
+
import com.opentok.android.Session.Builder.IncludeServers;
|
|
12
|
+
import com.opentok.android.Session.Builder.IceServer;
|
|
13
|
+
import com.opentok.android.BaseVideoCapturer.VideoContentHint;
|
|
14
|
+
|
|
15
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
15
16
|
|
|
16
17
|
import java.util.ArrayList;
|
|
17
|
-
import java.util.List;
|
|
18
18
|
import java.util.Map;
|
|
19
|
+
import java.util.List;
|
|
19
20
|
|
|
20
21
|
public final class Utils {
|
|
21
22
|
|
|
@@ -105,10 +106,6 @@ public final class Utils {
|
|
|
105
106
|
if (transformerList != null) {
|
|
106
107
|
for (int i = 0; i < transformerList.size(); i++) {
|
|
107
108
|
String transformerName = transformerList.getMap(i).getString("name");
|
|
108
|
-
if (transformerName == "BackgroundReplacement" ) {
|
|
109
|
-
// Only implemented in iOS -- ignore in Androd for now.
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
109
|
VideoTransformer transformer = publisher.new VideoTransformer(
|
|
113
110
|
transformerName,
|
|
114
111
|
transformerList.getMap(i).getString("properties")
|
package/ios/OTSessionManager.m
CHANGED
|
@@ -49,11 +49,10 @@ RCT_EXTERN_METHOD(publishVideo:
|
|
|
49
49
|
pubVideo:(BOOL)pubVideo)
|
|
50
50
|
RCT_EXTERN_METHOD(publishCaptions:
|
|
51
51
|
(NSString*)publisherId
|
|
52
|
-
|
|
52
|
+
pubCaptions:(BOOL)publishCaptions)
|
|
53
53
|
RCT_EXTERN_METHOD(getRtcStatsReport:
|
|
54
54
|
(NSString*)publisherId)
|
|
55
|
-
RCT_EXTERN_METHOD(getSubscriberRtcStatsReport
|
|
56
|
-
(NSString*)subscriberId)
|
|
55
|
+
RCT_EXTERN_METHOD(getSubscriberRtcStatsReport)
|
|
57
56
|
RCT_EXTERN_METHOD(subscribeToAudio:
|
|
58
57
|
(NSString*)streamId
|
|
59
58
|
subAudio:(BOOL)subAudio)
|
|
@@ -62,7 +61,7 @@ RCT_EXTERN_METHOD(subscribeToVideo:
|
|
|
62
61
|
subVideo:(BOOL)subVideo)
|
|
63
62
|
RCT_EXTERN_METHOD(subscribeToCaptions:
|
|
64
63
|
(NSString*)streamId
|
|
65
|
-
|
|
64
|
+
subCaptions:(BOOL)subCaptions)
|
|
66
65
|
RCT_EXTERN_METHOD(setPreferredResolution:
|
|
67
66
|
(NSString*)streamId
|
|
68
67
|
resolution:(NSDictionary*)resolution)
|
|
@@ -86,6 +85,10 @@ RCT_EXTERN_METHOD(sendSignal:
|
|
|
86
85
|
(NSString*)sessionId
|
|
87
86
|
signal:(NSDictionary*)signal
|
|
88
87
|
callback:(RCTResponseSenderBlock*)callback)
|
|
88
|
+
RCT_EXTERN_METHOD(setEncryptionSecret:
|
|
89
|
+
(NSString*)sessionId
|
|
90
|
+
secret:(NSString*)secret
|
|
91
|
+
callback:(RCTResponseSenderBlock*)callback)
|
|
89
92
|
RCT_EXTERN_METHOD(destroyPublisher:
|
|
90
93
|
(NSString*)publisherId
|
|
91
94
|
callback:(RCTResponseSenderBlock)callback)
|