react-native-altibbi 0.1.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.
Files changed (150) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +190 -0
  3. package/android/build.gradle +104 -0
  4. package/android/gradle.properties +5 -0
  5. package/android/src/main/AndroidManifest.xml +3 -0
  6. package/android/src/main/AndroidManifestNew.xml +2 -0
  7. package/android/src/main/java/com/altibbi/AltibbiModule.kt +18 -0
  8. package/android/src/main/java/com/altibbi/AltibbiPackage.kt +18 -0
  9. package/android/src/main/java/com/altibbi/OTCustomAudioDevice.java +1146 -0
  10. package/android/src/main/java/com/altibbi/OTPublisherLayout.java +61 -0
  11. package/android/src/main/java/com/altibbi/OTPublisherViewManager.java +30 -0
  12. package/android/src/main/java/com/altibbi/OTRN.java +101 -0
  13. package/android/src/main/java/com/altibbi/OTScreenCapturer.java +120 -0
  14. package/android/src/main/java/com/altibbi/OTSessionManager.java +1281 -0
  15. package/android/src/main/java/com/altibbi/OTSubscriberLayout.java +68 -0
  16. package/android/src/main/java/com/altibbi/OTSubscriberViewManager.java +30 -0
  17. package/android/src/main/java/com/altibbi/Socket.kt +294 -0
  18. package/android/src/main/java/com/altibbi/SocketEventEmitter.kt +25 -0
  19. package/android/src/main/java/com/altibbi/utils/EventUtils.java +189 -0
  20. package/android/src/main/java/com/altibbi/utils/Utils.java +135 -0
  21. package/ios/Altibbi-Bridging-Header.h +6 -0
  22. package/ios/Altibbi.mm +10 -0
  23. package/ios/Altibbi.swift +4 -0
  24. package/ios/OTCustomAudioDriver.swift +696 -0
  25. package/ios/OTPublisher.m +16 -0
  26. package/ios/OTPublisherManager.swift +21 -0
  27. package/ios/OTPublisherView.swift +28 -0
  28. package/ios/OTRN.swift +27 -0
  29. package/ios/OTScreenCapture.h +27 -0
  30. package/ios/OTScreenCapture.m +171 -0
  31. package/ios/OTSessionManager.m +127 -0
  32. package/ios/OTSessionManager.swift +866 -0
  33. package/ios/OTSubscriber.m +15 -0
  34. package/ios/OTSubscriberManager.swift +21 -0
  35. package/ios/OTSubscriberView.swift +29 -0
  36. package/ios/OpenTokReactNative.h +13 -0
  37. package/ios/OpenTokReactNative.m +13 -0
  38. package/ios/SocketReactNative.m +38 -0
  39. package/ios/SocketReactNative.swift +276 -0
  40. package/ios/Utils/EventUtils.swift +143 -0
  41. package/ios/Utils/Utils.swift +126 -0
  42. package/lib/commonjs/connection.js +200 -0
  43. package/lib/commonjs/connection.js.map +1 -0
  44. package/lib/commonjs/data.js +12 -0
  45. package/lib/commonjs/data.js.map +1 -0
  46. package/lib/commonjs/index.js +275 -0
  47. package/lib/commonjs/index.js.map +1 -0
  48. package/lib/commonjs/scoket.js +245 -0
  49. package/lib/commonjs/scoket.js.map +1 -0
  50. package/lib/commonjs/service.js +21 -0
  51. package/lib/commonjs/service.js.map +1 -0
  52. package/lib/commonjs/types.js +2 -0
  53. package/lib/commonjs/types.js.map +1 -0
  54. package/lib/commonjs/video/OT.js +57 -0
  55. package/lib/commonjs/video/OT.js.map +1 -0
  56. package/lib/commonjs/video/OTError.js +17 -0
  57. package/lib/commonjs/video/OTError.js.map +1 -0
  58. package/lib/commonjs/video/OTPublisher.js +171 -0
  59. package/lib/commonjs/video/OTPublisher.js.map +1 -0
  60. package/lib/commonjs/video/OTSession.js +205 -0
  61. package/lib/commonjs/video/OTSession.js.map +1 -0
  62. package/lib/commonjs/video/OTSubscriber.js +185 -0
  63. package/lib/commonjs/video/OTSubscriber.js.map +1 -0
  64. package/lib/commonjs/video/contexts/OTContext.js +11 -0
  65. package/lib/commonjs/video/contexts/OTContext.js.map +1 -0
  66. package/lib/commonjs/video/helpers/OTHelper.js +92 -0
  67. package/lib/commonjs/video/helpers/OTHelper.js.map +1 -0
  68. package/lib/commonjs/video/helpers/OTPublisherHelper.js +117 -0
  69. package/lib/commonjs/video/helpers/OTPublisherHelper.js.map +1 -0
  70. package/lib/commonjs/video/helpers/OTSessionHelper.js +206 -0
  71. package/lib/commonjs/video/helpers/OTSessionHelper.js.map +1 -0
  72. package/lib/commonjs/video/helpers/OTSubscriberHelper.js +121 -0
  73. package/lib/commonjs/video/helpers/OTSubscriberHelper.js.map +1 -0
  74. package/lib/commonjs/video/index.js +42 -0
  75. package/lib/commonjs/video/index.js.map +1 -0
  76. package/lib/commonjs/video/views/OTPublisherView.js +26 -0
  77. package/lib/commonjs/video/views/OTPublisherView.js.map +1 -0
  78. package/lib/commonjs/video/views/OTSubscriberView.js +25 -0
  79. package/lib/commonjs/video/views/OTSubscriberView.js.map +1 -0
  80. package/lib/module/connection.js +180 -0
  81. package/lib/module/connection.js.map +1 -0
  82. package/lib/module/data.js +6 -0
  83. package/lib/module/data.js.map +1 -0
  84. package/lib/module/index.js +12 -0
  85. package/lib/module/index.js.map +1 -0
  86. package/lib/module/scoket.js +235 -0
  87. package/lib/module/scoket.js.map +1 -0
  88. package/lib/module/service.js +14 -0
  89. package/lib/module/service.js.map +1 -0
  90. package/lib/module/types.js +2 -0
  91. package/lib/module/types.js.map +1 -0
  92. package/lib/module/video/OT.js +49 -0
  93. package/lib/module/video/OT.js.map +1 -0
  94. package/lib/module/video/OTError.js +10 -0
  95. package/lib/module/video/OTError.js.map +1 -0
  96. package/lib/module/video/OTPublisher.js +162 -0
  97. package/lib/module/video/OTPublisher.js.map +1 -0
  98. package/lib/module/video/OTSession.js +195 -0
  99. package/lib/module/video/OTSession.js.map +1 -0
  100. package/lib/module/video/OTSubscriber.js +175 -0
  101. package/lib/module/video/OTSubscriber.js.map +1 -0
  102. package/lib/module/video/contexts/OTContext.js +4 -0
  103. package/lib/module/video/contexts/OTContext.js.map +1 -0
  104. package/lib/module/video/helpers/OTHelper.js +82 -0
  105. package/lib/module/video/helpers/OTHelper.js.map +1 -0
  106. package/lib/module/video/helpers/OTPublisherHelper.js +110 -0
  107. package/lib/module/video/helpers/OTPublisherHelper.js.map +1 -0
  108. package/lib/module/video/helpers/OTSessionHelper.js +195 -0
  109. package/lib/module/video/helpers/OTSessionHelper.js.map +1 -0
  110. package/lib/module/video/helpers/OTSubscriberHelper.js +112 -0
  111. package/lib/module/video/helpers/OTSubscriberHelper.js.map +1 -0
  112. package/lib/module/video/index.js +7 -0
  113. package/lib/module/video/index.js.map +1 -0
  114. package/lib/module/video/views/OTPublisherView.js +18 -0
  115. package/lib/module/video/views/OTPublisherView.js.map +1 -0
  116. package/lib/module/video/views/OTSubscriberView.js +17 -0
  117. package/lib/module/video/views/OTSubscriberView.js.map +1 -0
  118. package/lib/typescript/src/connection.d.ts +40 -0
  119. package/lib/typescript/src/connection.d.ts.map +1 -0
  120. package/lib/typescript/src/data.d.ts +7 -0
  121. package/lib/typescript/src/data.d.ts.map +1 -0
  122. package/lib/typescript/src/index.d.ts +12 -0
  123. package/lib/typescript/src/index.d.ts.map +1 -0
  124. package/lib/typescript/src/scoket.d.ts +100 -0
  125. package/lib/typescript/src/scoket.d.ts.map +1 -0
  126. package/lib/typescript/src/service.d.ts +9 -0
  127. package/lib/typescript/src/service.d.ts.map +1 -0
  128. package/lib/typescript/src/types.d.ts +22 -0
  129. package/lib/typescript/src/types.d.ts.map +1 -0
  130. package/package.json +178 -0
  131. package/react-native-altibbi.podspec +46 -0
  132. package/src/connection.ts +255 -0
  133. package/src/data.ts +21 -0
  134. package/src/index.tsx +80 -0
  135. package/src/scoket.ts +365 -0
  136. package/src/service.ts +20 -0
  137. package/src/types.ts +22 -0
  138. package/src/video/OT.js +65 -0
  139. package/src/video/OTError.js +14 -0
  140. package/src/video/OTPublisher.js +193 -0
  141. package/src/video/OTSession.js +168 -0
  142. package/src/video/OTSubscriber.js +148 -0
  143. package/src/video/contexts/OTContext.js +5 -0
  144. package/src/video/helpers/OTHelper.js +91 -0
  145. package/src/video/helpers/OTPublisherHelper.js +122 -0
  146. package/src/video/helpers/OTSessionHelper.js +233 -0
  147. package/src/video/helpers/OTSubscriberHelper.js +125 -0
  148. package/src/video/index.js +13 -0
  149. package/src/video/views/OTPublisherView.js +19 -0
  150. package/src/video/views/OTSubscriberView.js +18 -0
@@ -0,0 +1,233 @@
1
+ import { Platform } from 'react-native';
2
+ import { reassignEvents } from './OTHelper';
3
+ import { handleSignalError, handleError } from '../OTError';
4
+ import {
5
+ each,
6
+ isNull,
7
+ isEmpty,
8
+ isString,
9
+ isBoolean,
10
+ isObject,
11
+ isArray
12
+ } from 'underscore';
13
+
14
+ const validateString = (value) => (isString(value) ? value : '');
15
+
16
+ const validateBoolean = (value) => (isBoolean(value) ? value : false);
17
+
18
+ const validateObject = (value) => (isObject(value) ? value : {});
19
+
20
+ const validateArray = (value) => (isArray(value) ? value : []);
21
+
22
+ const sanitizeSessionEvents = (sessionId, events) => {
23
+ if (typeof events !== 'object') {
24
+ return {};
25
+ }
26
+ const customEvents = {
27
+ ios: {
28
+ streamCreated: 'streamCreated',
29
+ streamDestroyed: 'streamDestroyed',
30
+ sessionConnected: 'sessionDidConnect',
31
+ sessionDisconnected: 'sessionDidDisconnect',
32
+ signal: 'signal',
33
+ connectionCreated: 'connectionCreated',
34
+ connectionDestroyed: 'connectionDestroyed',
35
+ error: 'didFailWithError',
36
+ sessionReconnected: 'sessionDidReconnect',
37
+ sessionReconnecting: 'sessionDidBeginReconnecting',
38
+ archiveStarted: 'archiveStartedWithId',
39
+ archiveStopped: 'archiveStoppedWithId',
40
+ streamPropertyChanged: 'streamPropertyChanged',
41
+ muteForced: 'muteForced',
42
+ },
43
+ android: {
44
+ streamCreated: 'onStreamReceived',
45
+ streamDestroyed: 'onStreamDropped',
46
+ sessionConnected: 'onConnected',
47
+ sessionDisconnected: 'onDisconnected',
48
+ signal: 'onSignalReceived',
49
+ connectionCreated: 'onConnectionCreated',
50
+ connectionDestroyed: 'onConnectionDestroyed',
51
+ error: 'onError',
52
+ sessionReconnected: 'onReconnected',
53
+ sessionReconnecting: 'onReconnecting',
54
+ archiveStarted: 'onArchiveStarted',
55
+ archiveStopped: 'onArchiveStopped',
56
+ streamPropertyChanged: 'onStreamPropertyChanged',
57
+ muteForced: 'onMuteForced',
58
+ }
59
+ };
60
+ return reassignEvents('session', customEvents, events, sessionId);
61
+ };
62
+
63
+ const sanitizeCustomTurnOptions = (options) => {
64
+ let sessionOptions = {};
65
+ if (typeof options !== 'object') {
66
+ return {};
67
+ }
68
+ const validCustomTurnOptions = {
69
+ includeServers: 'string',
70
+ transportPolicy: 'string',
71
+ customServers: 'Array'
72
+ };
73
+
74
+ const customTurnOptions = {
75
+ includeServers: 'all',
76
+ transportPolicy: 'all',
77
+ customServers: []
78
+ };
79
+
80
+ each(options, (value, key) => {
81
+ const optionType = validCustomTurnOptions[key];
82
+ if (optionType !== undefined) {
83
+ if (optionType === 'string') {
84
+ sessionOptions[key] = validateString(value);
85
+ } else if (optionType === 'Array') {
86
+ sessionOptions[key] = validateArray(value);
87
+ }
88
+ } else {
89
+ handleError(`${key} is not a valid option`);
90
+ }
91
+ });
92
+ return sessionOptions;
93
+ };
94
+
95
+ const sanitizeSessionOptions = (options) => {
96
+ const platform = Platform.OS;
97
+ let sessionOptions;
98
+
99
+ if (platform === 'android') {
100
+ sessionOptions = {
101
+ connectionEventsSuppressed: false,
102
+ ipWhitelist: false,
103
+ iceConfig: {},
104
+ proxyUrl: '',
105
+ useTextureViews: false,
106
+ enableStereoOutput: false,
107
+ androidOnTop: '', // 'publisher' || 'subscriber'
108
+ androidZOrder: '', // 'mediaOverlay' || 'onTop'
109
+ };
110
+ } else {
111
+ sessionOptions = {
112
+ connectionEventsSuppressed: false,
113
+ ipWhitelist: false,
114
+ iceConfig: {},
115
+ proxyUrl: '',
116
+ enableStereoOutput: false,
117
+ };
118
+ }
119
+
120
+ if (typeof options !== 'object') {
121
+ return sessionOptions;
122
+ }
123
+
124
+ const validSessionOptions = {
125
+ ios: {
126
+ connectionEventsSuppressed: 'boolean',
127
+ ipWhitelist: 'boolean',
128
+ iceConfig: 'object',
129
+ proxyUrl: 'string',
130
+ enableStereoOutput: 'boolean',
131
+ },
132
+ android: {
133
+ connectionEventsSuppressed: 'boolean',
134
+ useTextureViews: 'boolean',
135
+ androidOnTop: 'string',
136
+ androidZOrder: 'string',
137
+ ipWhitelist: 'boolean',
138
+ iceConfig: 'object',
139
+ proxyUrl: 'string',
140
+ enableStereoOutput: 'boolean',
141
+ },
142
+ };
143
+
144
+ each(options, (value, key) => {
145
+ const optionType = validSessionOptions[platform][key];
146
+ if (optionType !== undefined) {
147
+ if (optionType === 'boolean') {
148
+ sessionOptions[key] = validateBoolean(value);
149
+ } else if (optionType === 'string') {
150
+ sessionOptions[key] = validateString(value);
151
+ } else if (optionType === 'object') {
152
+ sessionOptions[key] = validateObject(value);
153
+ }
154
+ } else {
155
+ handleError(`${key} is not a valid option`);
156
+ }
157
+ });
158
+
159
+ if (sessionOptions.iceConfig) {
160
+ const customTurnOptions = sanitizeCustomTurnOptions(
161
+ sessionOptions.iceConfig
162
+ );
163
+ each(customTurnOptions, (value, key) => {
164
+ sessionOptions[key] = customTurnOptions[key];
165
+ });
166
+ }
167
+ return sessionOptions;
168
+ };
169
+
170
+ const sanitizeSignalData = (signal) => {
171
+ if (typeof signal !== 'object') {
172
+ return {
173
+ signal: {
174
+ type: '',
175
+ data: '',
176
+ to: ''
177
+ },
178
+ errorHandler: handleSignalError
179
+ };
180
+ }
181
+ return {
182
+ signal: {
183
+ type: validateString(signal.type),
184
+ data: validateString(signal.data),
185
+ to: validateString(signal.to)
186
+ },
187
+ errorHandler:
188
+ typeof signal.errorHandler !== 'function'
189
+ ? handleSignalError
190
+ : signal.errorHandler,
191
+ };
192
+ };
193
+
194
+ const sanitizeCredentials = (credentials) => {
195
+ const _credentials = {};
196
+ each(credentials, (value, key) => {
197
+ if (!isString(value) || isEmpty(value) || isNull(value)) {
198
+ handleError(`Please add the ${key}`);
199
+ } else {
200
+ _credentials[key] = value;
201
+ }
202
+ });
203
+ return _credentials;
204
+ };
205
+
206
+ const getConnectionStatus = (connectionStatus) => {
207
+ switch (connectionStatus) {
208
+ case 0:
209
+ return 'not connected';
210
+ case 1:
211
+ return 'connected';
212
+ case 2:
213
+ return 'connecting';
214
+ case 3:
215
+ return 'reconnecting';
216
+ case 4:
217
+ return 'disconnecting';
218
+ case 5:
219
+ return 'failed';
220
+ }
221
+ };
222
+
223
+ const isConnected = (connectionStatus) =>
224
+ getConnectionStatus(connectionStatus) === 'connected';
225
+
226
+ export {
227
+ sanitizeSessionEvents,
228
+ sanitizeSessionOptions,
229
+ sanitizeSignalData,
230
+ sanitizeCredentials,
231
+ getConnectionStatus,
232
+ isConnected
233
+ };
@@ -0,0 +1,125 @@
1
+ import { sanitizeBooleanProperty, reassignEvents } from './OTHelper';
2
+
3
+ /**
4
+ * This is the smallest positive int value for 2 bytes. Using Number.MAX_SAFE_INTEGER at JS level,
5
+ * could drive to problems when coverted to the native layer (Android & iOS).
6
+ * Since `32767` is a very high value for resolution and frame rate for all use case,
7
+ * we won't have any problem for the foreseeable future
8
+ */
9
+ const MAX_SAFE_INTEGER = 32767;
10
+
11
+ const sanitizeSubscriberEvents = (events) => {
12
+ if (typeof events !== 'object') {
13
+ return {};
14
+ }
15
+ const customEvents = {
16
+ ios: {
17
+ connected: 'subscriberDidConnect',
18
+ disconnected: 'subscriberDidDisconnect',
19
+ reconnected: 'subscriberDidReconnect',
20
+ error: 'didFailWithError',
21
+ audioNetworkStats: 'audioNetworkStatsUpdated',
22
+ videoNetworkStats: 'videoNetworkStatsUpdated',
23
+ audioLevel: 'audioLevelUpdated',
24
+ rtcStatsReport: 'rtcStatsReport',
25
+ videoDisabled: 'subscriberVideoDisabled',
26
+ videoEnabled: 'subscriberVideoEnabled',
27
+ videoDisableWarning: 'subscriberVideoDisableWarning',
28
+ videoDisableWarningLifted: 'subscriberVideoDisableWarningLifted',
29
+ videoDataReceived: 'subscriberVideoDataReceived',
30
+ captionReceived: 'subscriberCaptionReceived:',
31
+ },
32
+ android: {
33
+ connected: 'onConnected',
34
+ disconnected: 'onDisconnected',
35
+ reconnected: 'onReconnected',
36
+ error: 'onError',
37
+ audioNetworkStats: 'onAudioStats',
38
+ rtcStatsReport: 'onRtcStatsReport',
39
+ videoNetworkStats: 'onVideoStats',
40
+ audioLevel: 'onAudioLevelUpdated',
41
+ videoDisabled: 'onVideoDisabled',
42
+ videoEnabled: 'onVideoEnabled',
43
+ videoDisableWarning: 'onVideoDisableWarning',
44
+ videoDisableWarningLifted: 'onVideoDisableWarningLifted',
45
+ videoDataReceived: 'onVideoDataReceived',
46
+ captionReceived: 'onCaptionText',
47
+ },
48
+ };
49
+ return reassignEvents('subscriber', customEvents, events);
50
+ };
51
+
52
+ const sanitizeResolution = (resolution) => {
53
+ if ((typeof resolution !== 'object') || (resolution &&
54
+ resolution.width === void 0 &&
55
+ resolution.height === void 0) ||
56
+ (resolution === null)) {
57
+ return { width: MAX_SAFE_INTEGER, height: MAX_SAFE_INTEGER };
58
+ }
59
+ const videoDimensions = {};
60
+ if (resolution && resolution.height) {
61
+ if (isNaN(parseInt(resolution.height, 10))) {
62
+ videoDimensions.height = void 0;
63
+ }
64
+
65
+ videoDimensions.height = parseInt(resolution.height, 10);
66
+ } else {
67
+ videoDimensions.height = void 0;
68
+ }
69
+ if (resolution && resolution.width) {
70
+ if (isNaN(parseInt(resolution.width, 10))) {
71
+ videoDimensions.width = void 0;
72
+ }
73
+
74
+ videoDimensions.width = parseInt(resolution.width, 10);
75
+ } else {
76
+ videoDimensions.width = void 0;
77
+ }
78
+ return videoDimensions;
79
+ };
80
+
81
+ const sanitizeFrameRate = (frameRate) => {
82
+ switch (frameRate) {
83
+ case null:
84
+ return MAX_SAFE_INTEGER;
85
+ case 1:
86
+ return 1;
87
+ case 7:
88
+ return 7;
89
+ case 15:
90
+ return 15;
91
+ default:
92
+ return 30;
93
+ }
94
+ };
95
+
96
+ const sanitizeAudioVolume = audioVolume => (typeof audioVolume === 'number') ? audioVolume : 100;
97
+
98
+ const sanitizeProperties = (properties) => {
99
+ if (typeof properties !== 'object') {
100
+ return {
101
+ subscribeToAudio: true,
102
+ subscribeToVideo: true,
103
+ subscribeToCaptions: false,
104
+ preferredResolution: sanitizeResolution(null),
105
+ preferredFrameRate: sanitizeFrameRate(null),
106
+ audioVolume: 100,
107
+ };
108
+ }
109
+ return {
110
+ subscribeToAudio: sanitizeBooleanProperty(properties.subscribeToAudio),
111
+ subscribeToVideo: sanitizeBooleanProperty(properties.subscribeToVideo),
112
+ subscribeToCaptions: sanitizeBooleanProperty(properties.subscribeToCaptions),
113
+ preferredResolution: sanitizeResolution(properties.preferredResolution),
114
+ preferredFrameRate: sanitizeFrameRate(properties.preferredFrameRate),
115
+ audioVolume: sanitizeAudioVolume(properties.audioVolume),
116
+ };
117
+ };
118
+
119
+ export {
120
+ sanitizeSubscriberEvents,
121
+ sanitizeProperties,
122
+ sanitizeFrameRate,
123
+ sanitizeResolution,
124
+ sanitizeAudioVolume
125
+ };
@@ -0,0 +1,13 @@
1
+ import OTSession from './OTSession';
2
+ import OTPublisher from './OTPublisher';
3
+ import OTSubscriber from './OTSubscriber';
4
+ import OTSubscriberView from './views/OTSubscriberView';
5
+ import { OT } from './OT';
6
+
7
+ export {
8
+ OTSession,
9
+ OTPublisher,
10
+ OTSubscriber,
11
+ OTSubscriberView,
12
+ OT,
13
+ };
@@ -0,0 +1,19 @@
1
+ import React, { Component } from 'react';
2
+ import { PropTypes } from 'prop-types';
3
+ import { requireNativeComponent, Platform, View } from 'react-native';
4
+
5
+ class OTPublisherView extends Component {
6
+ render() {
7
+ return <ReactPublisher {...this.props} />;
8
+ }
9
+ }
10
+ const viewPropTypes = View.propTypes;
11
+ OTPublisherView.propTypes = {
12
+ publisherId: PropTypes.string.isRequired,
13
+ sessionId: PropTypes.string.isRequired,
14
+ ...viewPropTypes,
15
+ };
16
+
17
+ const publisherName = Platform.OS === 'ios' ? 'OTPublisherSwift' : 'OTPublisherViewManager';
18
+ const ReactPublisher = requireNativeComponent(publisherName, OTPublisherView);
19
+ export default OTPublisherView;
@@ -0,0 +1,18 @@
1
+ import React, { Component } from 'react';
2
+ import { PropTypes } from 'prop-types';
3
+ import { requireNativeComponent, Platform, View } from 'react-native';
4
+
5
+ class OTSubscriberView extends Component {
6
+ render() {
7
+ return <ReactSubscriber {...this.props} />;
8
+ }
9
+ }
10
+ const viewPropTypes = View.propTypes;
11
+ OTSubscriberView.propTypes = {
12
+ streamId: PropTypes.string.isRequired,
13
+ ...viewPropTypes,
14
+ };
15
+
16
+ const subscriberName = Platform.OS === 'ios' ? 'OTSubscriberSwift' : 'OTSubscriberViewManager';
17
+ const ReactSubscriber = requireNativeComponent(subscriberName, OTSubscriberView);
18
+ export default OTSubscriberView;