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.
- package/LICENSE +20 -0
- package/README.md +190 -0
- package/android/build.gradle +104 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/altibbi/AltibbiModule.kt +18 -0
- package/android/src/main/java/com/altibbi/AltibbiPackage.kt +18 -0
- package/android/src/main/java/com/altibbi/OTCustomAudioDevice.java +1146 -0
- package/android/src/main/java/com/altibbi/OTPublisherLayout.java +61 -0
- package/android/src/main/java/com/altibbi/OTPublisherViewManager.java +30 -0
- package/android/src/main/java/com/altibbi/OTRN.java +101 -0
- package/android/src/main/java/com/altibbi/OTScreenCapturer.java +120 -0
- package/android/src/main/java/com/altibbi/OTSessionManager.java +1281 -0
- package/android/src/main/java/com/altibbi/OTSubscriberLayout.java +68 -0
- package/android/src/main/java/com/altibbi/OTSubscriberViewManager.java +30 -0
- package/android/src/main/java/com/altibbi/Socket.kt +294 -0
- package/android/src/main/java/com/altibbi/SocketEventEmitter.kt +25 -0
- package/android/src/main/java/com/altibbi/utils/EventUtils.java +189 -0
- package/android/src/main/java/com/altibbi/utils/Utils.java +135 -0
- package/ios/Altibbi-Bridging-Header.h +6 -0
- package/ios/Altibbi.mm +10 -0
- package/ios/Altibbi.swift +4 -0
- package/ios/OTCustomAudioDriver.swift +696 -0
- package/ios/OTPublisher.m +16 -0
- package/ios/OTPublisherManager.swift +21 -0
- package/ios/OTPublisherView.swift +28 -0
- package/ios/OTRN.swift +27 -0
- package/ios/OTScreenCapture.h +27 -0
- package/ios/OTScreenCapture.m +171 -0
- package/ios/OTSessionManager.m +127 -0
- package/ios/OTSessionManager.swift +866 -0
- package/ios/OTSubscriber.m +15 -0
- package/ios/OTSubscriberManager.swift +21 -0
- package/ios/OTSubscriberView.swift +29 -0
- package/ios/OpenTokReactNative.h +13 -0
- package/ios/OpenTokReactNative.m +13 -0
- package/ios/SocketReactNative.m +38 -0
- package/ios/SocketReactNative.swift +276 -0
- package/ios/Utils/EventUtils.swift +143 -0
- package/ios/Utils/Utils.swift +126 -0
- package/lib/commonjs/connection.js +200 -0
- package/lib/commonjs/connection.js.map +1 -0
- package/lib/commonjs/data.js +12 -0
- package/lib/commonjs/data.js.map +1 -0
- package/lib/commonjs/index.js +275 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/scoket.js +245 -0
- package/lib/commonjs/scoket.js.map +1 -0
- package/lib/commonjs/service.js +21 -0
- package/lib/commonjs/service.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/video/OT.js +57 -0
- package/lib/commonjs/video/OT.js.map +1 -0
- package/lib/commonjs/video/OTError.js +17 -0
- package/lib/commonjs/video/OTError.js.map +1 -0
- package/lib/commonjs/video/OTPublisher.js +171 -0
- package/lib/commonjs/video/OTPublisher.js.map +1 -0
- package/lib/commonjs/video/OTSession.js +205 -0
- package/lib/commonjs/video/OTSession.js.map +1 -0
- package/lib/commonjs/video/OTSubscriber.js +185 -0
- package/lib/commonjs/video/OTSubscriber.js.map +1 -0
- package/lib/commonjs/video/contexts/OTContext.js +11 -0
- package/lib/commonjs/video/contexts/OTContext.js.map +1 -0
- package/lib/commonjs/video/helpers/OTHelper.js +92 -0
- package/lib/commonjs/video/helpers/OTHelper.js.map +1 -0
- package/lib/commonjs/video/helpers/OTPublisherHelper.js +117 -0
- package/lib/commonjs/video/helpers/OTPublisherHelper.js.map +1 -0
- package/lib/commonjs/video/helpers/OTSessionHelper.js +206 -0
- package/lib/commonjs/video/helpers/OTSessionHelper.js.map +1 -0
- package/lib/commonjs/video/helpers/OTSubscriberHelper.js +121 -0
- package/lib/commonjs/video/helpers/OTSubscriberHelper.js.map +1 -0
- package/lib/commonjs/video/index.js +42 -0
- package/lib/commonjs/video/index.js.map +1 -0
- package/lib/commonjs/video/views/OTPublisherView.js +26 -0
- package/lib/commonjs/video/views/OTPublisherView.js.map +1 -0
- package/lib/commonjs/video/views/OTSubscriberView.js +25 -0
- package/lib/commonjs/video/views/OTSubscriberView.js.map +1 -0
- package/lib/module/connection.js +180 -0
- package/lib/module/connection.js.map +1 -0
- package/lib/module/data.js +6 -0
- package/lib/module/data.js.map +1 -0
- package/lib/module/index.js +12 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/scoket.js +235 -0
- package/lib/module/scoket.js.map +1 -0
- package/lib/module/service.js +14 -0
- package/lib/module/service.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/video/OT.js +49 -0
- package/lib/module/video/OT.js.map +1 -0
- package/lib/module/video/OTError.js +10 -0
- package/lib/module/video/OTError.js.map +1 -0
- package/lib/module/video/OTPublisher.js +162 -0
- package/lib/module/video/OTPublisher.js.map +1 -0
- package/lib/module/video/OTSession.js +195 -0
- package/lib/module/video/OTSession.js.map +1 -0
- package/lib/module/video/OTSubscriber.js +175 -0
- package/lib/module/video/OTSubscriber.js.map +1 -0
- package/lib/module/video/contexts/OTContext.js +4 -0
- package/lib/module/video/contexts/OTContext.js.map +1 -0
- package/lib/module/video/helpers/OTHelper.js +82 -0
- package/lib/module/video/helpers/OTHelper.js.map +1 -0
- package/lib/module/video/helpers/OTPublisherHelper.js +110 -0
- package/lib/module/video/helpers/OTPublisherHelper.js.map +1 -0
- package/lib/module/video/helpers/OTSessionHelper.js +195 -0
- package/lib/module/video/helpers/OTSessionHelper.js.map +1 -0
- package/lib/module/video/helpers/OTSubscriberHelper.js +112 -0
- package/lib/module/video/helpers/OTSubscriberHelper.js.map +1 -0
- package/lib/module/video/index.js +7 -0
- package/lib/module/video/index.js.map +1 -0
- package/lib/module/video/views/OTPublisherView.js +18 -0
- package/lib/module/video/views/OTPublisherView.js.map +1 -0
- package/lib/module/video/views/OTSubscriberView.js +17 -0
- package/lib/module/video/views/OTSubscriberView.js.map +1 -0
- package/lib/typescript/src/connection.d.ts +40 -0
- package/lib/typescript/src/connection.d.ts.map +1 -0
- package/lib/typescript/src/data.d.ts +7 -0
- package/lib/typescript/src/data.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +12 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/scoket.d.ts +100 -0
- package/lib/typescript/src/scoket.d.ts.map +1 -0
- package/lib/typescript/src/service.d.ts +9 -0
- package/lib/typescript/src/service.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +22 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +178 -0
- package/react-native-altibbi.podspec +46 -0
- package/src/connection.ts +255 -0
- package/src/data.ts +21 -0
- package/src/index.tsx +80 -0
- package/src/scoket.ts +365 -0
- package/src/service.ts +20 -0
- package/src/types.ts +22 -0
- package/src/video/OT.js +65 -0
- package/src/video/OTError.js +14 -0
- package/src/video/OTPublisher.js +193 -0
- package/src/video/OTSession.js +168 -0
- package/src/video/OTSubscriber.js +148 -0
- package/src/video/contexts/OTContext.js +5 -0
- package/src/video/helpers/OTHelper.js +91 -0
- package/src/video/helpers/OTPublisherHelper.js +122 -0
- package/src/video/helpers/OTSessionHelper.js +233 -0
- package/src/video/helpers/OTSubscriberHelper.js +125 -0
- package/src/video/index.js +13 -0
- package/src/video/views/OTPublisherView.js +19 -0
- package/src/video/views/OTSubscriberView.js +18 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// OTPublisher.m
|
|
3
|
+
// OpenTokReactNative
|
|
4
|
+
//
|
|
5
|
+
// Created by Manik Sachdeva on 1/17/18.
|
|
6
|
+
// Copyright © 2018 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import <React/RCTViewManager.h>
|
|
11
|
+
|
|
12
|
+
@interface RCT_EXTERN_MODULE(OTPublisherSwift, RCTViewManager)
|
|
13
|
+
RCT_EXPORT_VIEW_PROPERTY(publisherId, NSString)
|
|
14
|
+
|
|
15
|
+
@end
|
|
16
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// OTPublisher.swift
|
|
3
|
+
// OpenTokReactNative
|
|
4
|
+
//
|
|
5
|
+
// Created by Manik Sachdeva on 1/17/18.
|
|
6
|
+
// Copyright © 2018 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
import Foundation
|
|
10
|
+
|
|
11
|
+
@objc(OTPublisherSwift)
|
|
12
|
+
class OTPublisherManager: RCTViewManager {
|
|
13
|
+
override func view() -> UIView {
|
|
14
|
+
return OTPublisherView();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
override static func requiresMainQueueSetup() -> Bool {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// OTPublisherView.swift
|
|
3
|
+
// OpenTokReactNative
|
|
4
|
+
//
|
|
5
|
+
// Created by Manik Sachdeva on 1/17/18.
|
|
6
|
+
// Copyright © 2018 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
import Foundation
|
|
10
|
+
|
|
11
|
+
@objc(OTPublisherView)
|
|
12
|
+
class OTPublisherView : UIView {
|
|
13
|
+
@objc var publisherId: NSString?
|
|
14
|
+
override init(frame: CGRect) {
|
|
15
|
+
super.init(frame: frame)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
required init?(coder aDecoder: NSCoder) {
|
|
19
|
+
fatalError("init(coder:) has not been implemented")
|
|
20
|
+
}
|
|
21
|
+
override func layoutSubviews() {
|
|
22
|
+
if let publisherView = OTRN.sharedState.publishers[publisherId! as String]?.view {
|
|
23
|
+
publisherView.frame = self.bounds
|
|
24
|
+
addSubview(publisherView)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
package/ios/OTRN.swift
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// OTRN.swift
|
|
3
|
+
// OpenTokReactNative
|
|
4
|
+
//
|
|
5
|
+
// Created by Manik Sachdeva on 1/16/18.
|
|
6
|
+
// Copyright © 2018 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
import Foundation
|
|
10
|
+
|
|
11
|
+
class OTRN : NSObject {
|
|
12
|
+
static let sharedState = OTRN()
|
|
13
|
+
var sessions = [String: OTSession]()
|
|
14
|
+
var subscriberStreams = [String: OTStream]()
|
|
15
|
+
var subscribers = [String: OTSubscriber]()
|
|
16
|
+
var publishers = [String: OTPublisher]()
|
|
17
|
+
var publisherStreams = [String: OTStream]()
|
|
18
|
+
var publisherDestroyedCallbacks = [String: RCTResponseSenderBlock]()
|
|
19
|
+
var sessionConnectCallbacks = [String: RCTResponseSenderBlock]()
|
|
20
|
+
var sessionDisconnectCallbacks = [String: RCTResponseSenderBlock]()
|
|
21
|
+
var isPublishing = [String: Bool]()
|
|
22
|
+
var streamObservers = [String: [NSKeyValueObservation]]()
|
|
23
|
+
var connections = [String: OTConnection]()
|
|
24
|
+
override init() {
|
|
25
|
+
super.init()
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// OTScreenCapture.h
|
|
3
|
+
// Screen-Sharing
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) 2014 TokBox Inc. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <OpenTok/OpenTok.h>
|
|
10
|
+
|
|
11
|
+
@protocol OTVideoCapture;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Periodically sends video frames to an OpenTok Publisher by rendering the
|
|
15
|
+
* CALayer for a UIView.
|
|
16
|
+
*/
|
|
17
|
+
@interface OTScreenCapture : NSObject <OTVideoCapture>
|
|
18
|
+
|
|
19
|
+
@property(readonly) UIView* view;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Initializes a video capturer that will grab rendered stills of the view.
|
|
23
|
+
*/
|
|
24
|
+
- (instancetype)initWithView:(UIView*)view;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@end
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
//
|
|
2
|
+
// OTScreenCapture.m
|
|
3
|
+
// Screen-Sharing
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) 2014 TokBox Inc. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#include <mach/mach.h>
|
|
9
|
+
#include <mach/mach_time.h>
|
|
10
|
+
#import <ReplayKit/ReplayKit.h>
|
|
11
|
+
#import "OTScreenCapture.h"
|
|
12
|
+
|
|
13
|
+
@implementation OTScreenCapture {
|
|
14
|
+
dispatch_queue_t _queue;
|
|
15
|
+
|
|
16
|
+
CVPixelBufferRef _pixelBuffer;
|
|
17
|
+
BOOL _capturing;
|
|
18
|
+
OTVideoFrame* _videoFrame;
|
|
19
|
+
UIView* _view;
|
|
20
|
+
|
|
21
|
+
CGFloat _screenScale;
|
|
22
|
+
CGContextRef _bitmapContext;
|
|
23
|
+
|
|
24
|
+
CADisplayLink *_displayLink;
|
|
25
|
+
dispatch_semaphore_t _capturingSemaphore;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@synthesize videoCaptureConsumer;
|
|
29
|
+
@synthesize videoContentHint;
|
|
30
|
+
|
|
31
|
+
#pragma mark - Class Lifecycle.
|
|
32
|
+
|
|
33
|
+
- (instancetype)initWithView:(UIView *)view
|
|
34
|
+
{
|
|
35
|
+
self = [super init];
|
|
36
|
+
if (self) {
|
|
37
|
+
_view = view;
|
|
38
|
+
_queue = dispatch_queue_create("SCREEN_CAPTURE", NULL);
|
|
39
|
+
_screenScale = [[UIScreen mainScreen] scale];
|
|
40
|
+
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(captureView)];
|
|
41
|
+
_displayLink.preferredFramesPerSecond = 30.0;
|
|
42
|
+
_capturingSemaphore = dispatch_semaphore_create(1);
|
|
43
|
+
[self createPixelBuffer];
|
|
44
|
+
[self createCGContextFromPixelBuffer];
|
|
45
|
+
}
|
|
46
|
+
return self;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
- (void)dealloc
|
|
50
|
+
{
|
|
51
|
+
[self stopCapture];
|
|
52
|
+
if(_bitmapContext)
|
|
53
|
+
CGContextRelease(_bitmapContext);
|
|
54
|
+
if(_pixelBuffer)
|
|
55
|
+
CVPixelBufferRelease(_pixelBuffer);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#pragma mark - Private Methods
|
|
59
|
+
|
|
60
|
+
- (CMTime)getTimeStamp {
|
|
61
|
+
static mach_timebase_info_data_t time_info;
|
|
62
|
+
uint64_t time_stamp = 0;
|
|
63
|
+
if (time_info.denom == 0) {
|
|
64
|
+
(void) mach_timebase_info(&time_info);
|
|
65
|
+
}
|
|
66
|
+
time_stamp = mach_absolute_time();
|
|
67
|
+
time_stamp *= time_info.numer;
|
|
68
|
+
time_stamp /= time_info.denom;
|
|
69
|
+
CMTime time = CMTimeMake(time_stamp, 1000);
|
|
70
|
+
return time;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
-(void)captureView
|
|
74
|
+
{
|
|
75
|
+
if (!(_capturing && self.videoCaptureConsumer)) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Wait until consumeImageBuffer is done.
|
|
80
|
+
if (dispatch_semaphore_wait(_capturingSemaphore, DISPATCH_TIME_NOW) != 0) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
85
|
+
[self.view.layer renderInContext:self->_bitmapContext];
|
|
86
|
+
// Don't block the UI thread
|
|
87
|
+
dispatch_async(self->_queue, ^{
|
|
88
|
+
CMTime time = [self getTimeStamp];
|
|
89
|
+
[self.videoCaptureConsumer consumeImageBuffer:self->_pixelBuffer
|
|
90
|
+
orientation:OTVideoOrientationUp
|
|
91
|
+
timestamp:time
|
|
92
|
+
metadata:nil];
|
|
93
|
+
// Signal for more frames
|
|
94
|
+
dispatch_semaphore_signal(self->_capturingSemaphore);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
- (void)createCGContextFromPixelBuffer {
|
|
100
|
+
CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB();
|
|
101
|
+
CVPixelBufferLockBaseAddress(_pixelBuffer, 0);
|
|
102
|
+
|
|
103
|
+
_bitmapContext = CGBitmapContextCreate(CVPixelBufferGetBaseAddress(_pixelBuffer),
|
|
104
|
+
CVPixelBufferGetWidth(_pixelBuffer),
|
|
105
|
+
CVPixelBufferGetHeight(_pixelBuffer),
|
|
106
|
+
8, CVPixelBufferGetBytesPerRow(_pixelBuffer), rgbColorSpace,
|
|
107
|
+
kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst
|
|
108
|
+
);
|
|
109
|
+
CGContextTranslateCTM(_bitmapContext, 0.0f, self.view.frame.size.height);
|
|
110
|
+
CGContextScaleCTM(_bitmapContext, self.view.layer.contentsScale, -self.view.layer.contentsScale);
|
|
111
|
+
CVPixelBufferUnlockBaseAddress(_pixelBuffer, 0);
|
|
112
|
+
CFRelease(rgbColorSpace);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
- (void)createPixelBuffer {
|
|
116
|
+
|
|
117
|
+
CFDictionaryRef ioSurfaceProps = CFDictionaryCreate( kCFAllocatorDefault, NULL, NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks );
|
|
118
|
+
|
|
119
|
+
NSDictionary *bufferAttributes = @{(id)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_32BGRA),
|
|
120
|
+
(id)kCVPixelBufferCGBitmapContextCompatibilityKey : @YES,
|
|
121
|
+
(id)kCVPixelBufferWidthKey : @(self.view.frame.size.width * _screenScale),
|
|
122
|
+
(id)kCVPixelBufferHeightKey : @(self.view.frame.size.height * _screenScale),
|
|
123
|
+
(id)kCVPixelBufferBytesPerRowAlignmentKey :
|
|
124
|
+
@(self.view.frame.size.width * _screenScale * 4),
|
|
125
|
+
(id)kCVPixelBufferIOSurfacePropertiesKey : (__bridge id)ioSurfaceProps
|
|
126
|
+
};
|
|
127
|
+
CVPixelBufferCreate(kCFAllocatorDefault,
|
|
128
|
+
self.view.frame.size.width,
|
|
129
|
+
self.view.frame.size.height,
|
|
130
|
+
kCVPixelFormatType_32ARGB,
|
|
131
|
+
(__bridge CFDictionaryRef)(bufferAttributes),
|
|
132
|
+
&_pixelBuffer);
|
|
133
|
+
CFRelease(ioSurfaceProps);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
#pragma mark - Capture lifecycle
|
|
137
|
+
|
|
138
|
+
- (void)initCapture {
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
- (void)releaseCapture {
|
|
143
|
+
[_displayLink invalidate];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
- (int32_t)startCapture
|
|
147
|
+
{
|
|
148
|
+
_capturing = YES;
|
|
149
|
+
[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
|
|
150
|
+
return 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
- (int32_t)stopCapture
|
|
154
|
+
{
|
|
155
|
+
_capturing = NO;
|
|
156
|
+
[_displayLink invalidate];
|
|
157
|
+
return 0;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
- (BOOL)isCaptureStarted
|
|
161
|
+
{
|
|
162
|
+
return _capturing;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
- (int32_t)captureSettings:(OTVideoFormat*)videoFormat
|
|
166
|
+
{
|
|
167
|
+
videoFormat.pixelFormat = OTPixelFormatARGB;
|
|
168
|
+
return 0;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@end
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
//
|
|
2
|
+
// OTSessionManager.m
|
|
3
|
+
// OpenTokReactNative
|
|
4
|
+
//
|
|
5
|
+
// Created by Manik Sachdeva on 1/12/18.
|
|
6
|
+
// Copyright © 2018 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import <React/RCTBridgeModule.h>
|
|
11
|
+
#import <React/RCTBridgeMethod.h>
|
|
12
|
+
#import <React/RCTEventEmitter.h>
|
|
13
|
+
|
|
14
|
+
@interface RCT_EXTERN_MODULE(OTSessionManager, RCTEventEmitter)
|
|
15
|
+
|
|
16
|
+
RCT_EXTERN_METHOD(initSession:
|
|
17
|
+
(NSString*)apiKey
|
|
18
|
+
sessionId:(NSString*)sessionId
|
|
19
|
+
sessionOptions:(NSDictionary*)sessionOptions)
|
|
20
|
+
RCT_EXTERN_METHOD(connect:
|
|
21
|
+
(NSString*)sessionId
|
|
22
|
+
token:(NSString*)token
|
|
23
|
+
callback:(RCTResponseSenderBlock*)callback)
|
|
24
|
+
RCT_EXTERN_METHOD(initPublisher:
|
|
25
|
+
(NSString*)publisherId
|
|
26
|
+
properties:(NSDictionary*)properties
|
|
27
|
+
callback:(RCTResponseSenderBlock*)callback)
|
|
28
|
+
RCT_EXTERN_METHOD(publish:
|
|
29
|
+
(NSString*)sessionId
|
|
30
|
+
publisherId:(NSString*)publisherId
|
|
31
|
+
callback:(RCTResponseSenderBlock*)callback)
|
|
32
|
+
RCT_EXTERN_METHOD(subscribeToStream:
|
|
33
|
+
(NSString*)streamId
|
|
34
|
+
sessionId:
|
|
35
|
+
(NSString*)sessionId
|
|
36
|
+
properties:(NSDictionary*)properties
|
|
37
|
+
callback:(RCTResponseSenderBlock*)callback)
|
|
38
|
+
RCT_EXTERN_METHOD(removeSubscriber:
|
|
39
|
+
(NSString*)streamId
|
|
40
|
+
callback:(RCTResponseSenderBlock*)callback)
|
|
41
|
+
RCT_EXTERN_METHOD(disconnectSession:
|
|
42
|
+
(NSString*)sessionId
|
|
43
|
+
callback:(RCTResponseSenderBlock*)callback)
|
|
44
|
+
RCT_EXTERN_METHOD(publishAudio:
|
|
45
|
+
(NSString*)publisherId
|
|
46
|
+
pubAudio:(BOOL)pubAudio)
|
|
47
|
+
RCT_EXTERN_METHOD(publishVideo:
|
|
48
|
+
(NSString*)publisherId
|
|
49
|
+
pubVideo:(BOOL)pubVideo)
|
|
50
|
+
RCT_EXTERN_METHOD(publishCaptions:
|
|
51
|
+
(NSString*)publisherId
|
|
52
|
+
pubAudio:(BOOL)publishCaptions)
|
|
53
|
+
RCT_EXTERN_METHOD(getRtcStatsReport:
|
|
54
|
+
(NSString*)publisherId)
|
|
55
|
+
RCT_EXTERN_METHOD(getSubscriberRtcStatsReport:
|
|
56
|
+
(NSString*)subscriberId)
|
|
57
|
+
RCT_EXTERN_METHOD(subscribeToAudio:
|
|
58
|
+
(NSString*)streamId
|
|
59
|
+
subAudio:(BOOL)subAudio)
|
|
60
|
+
RCT_EXTERN_METHOD(subscribeToVideo:
|
|
61
|
+
(NSString*)streamId
|
|
62
|
+
subVideo:(BOOL)subVideo)
|
|
63
|
+
RCT_EXTERN_METHOD(subscribeToCaptions:
|
|
64
|
+
(NSString*)streamId
|
|
65
|
+
subAudio:(BOOL)subCaptions)
|
|
66
|
+
RCT_EXTERN_METHOD(setPreferredResolution:
|
|
67
|
+
(NSString*)streamId
|
|
68
|
+
resolution:(NSDictionary*)resolution)
|
|
69
|
+
RCT_EXTERN_METHOD(setPreferredFrameRate:
|
|
70
|
+
(NSString*)streamId
|
|
71
|
+
frameRate:(nonnull NSNumber*)frameRate)
|
|
72
|
+
RCT_EXTERN_METHOD(setAudioVolume:
|
|
73
|
+
(NSString*)streamId
|
|
74
|
+
audioVolume:(nonnull NSNumber*)audioVolume)
|
|
75
|
+
RCT_EXTERN_METHOD(changeCameraPosition:
|
|
76
|
+
(NSString*)publisherId
|
|
77
|
+
cameraPosition:(NSString*)cameraPosition)
|
|
78
|
+
RCT_EXTERN_METHOD(changeVideoContentHint:
|
|
79
|
+
(NSString*)publisherId
|
|
80
|
+
videoContentHint:(NSString*)videoContentHint)
|
|
81
|
+
RCT_EXTERN_METHOD(setNativeEvents:
|
|
82
|
+
(NSArray*)events)
|
|
83
|
+
RCT_EXTERN_METHOD(removeNativeEvents:
|
|
84
|
+
(NSArray*)events)
|
|
85
|
+
RCT_EXTERN_METHOD(sendSignal:
|
|
86
|
+
(NSString*)sessionId
|
|
87
|
+
signal:(NSDictionary*)signal
|
|
88
|
+
callback:(RCTResponseSenderBlock*)callback)
|
|
89
|
+
RCT_EXTERN_METHOD(destroyPublisher:
|
|
90
|
+
(NSString*)publisherId
|
|
91
|
+
callback:(RCTResponseSenderBlock)callback)
|
|
92
|
+
RCT_EXTERN_METHOD(setJSComponentEvents:
|
|
93
|
+
(NSArray*)events)
|
|
94
|
+
RCT_EXTERN_METHOD(setVideoTransformers:
|
|
95
|
+
(NSString*)publisherId
|
|
96
|
+
videoTransformers:(NSArray*)videoTransformers)
|
|
97
|
+
RCT_EXTERN_METHOD(removeJSComponentEvents:
|
|
98
|
+
(NSArray*)events)
|
|
99
|
+
RCT_EXTERN_METHOD(getSessionInfo:
|
|
100
|
+
(NSString*)sessionId
|
|
101
|
+
callback:(RCTResponseSenderBlock*)callback)
|
|
102
|
+
RCT_EXTERN_METHOD(getSessionCapabilities:
|
|
103
|
+
(NSString*)sessionId
|
|
104
|
+
callback:(RCTResponseSenderBlock*)callback)
|
|
105
|
+
RCT_EXTERN_METHOD(reportIssue:
|
|
106
|
+
(NSString*)sessionId
|
|
107
|
+
callback:(RCTResponseSenderBlock*)callback)
|
|
108
|
+
RCT_EXTERN_METHOD(getSupportedCodecs:
|
|
109
|
+
(RCTPromiseResolveBlock)resolve
|
|
110
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
111
|
+
RCT_EXTERN_METHOD(forceMuteAll:
|
|
112
|
+
(NSString*)sessionId
|
|
113
|
+
excludedStreamIds:(NSArray*)excludedStreamIds
|
|
114
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
115
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
116
|
+
RCT_EXTERN_METHOD(forceMuteStream:
|
|
117
|
+
(NSString*)sessionId
|
|
118
|
+
streamId:(NSString*)streamId
|
|
119
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
120
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
121
|
+
RCT_EXTERN_METHOD(disableForceMute:
|
|
122
|
+
(NSString*)sessionId
|
|
123
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
124
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
125
|
+
RCT_EXTERN_METHOD(enableLogs:
|
|
126
|
+
(BOOL)logLevel)
|
|
127
|
+
@end
|