@100mslive/react-native-hms 1.12.2 → 2.0.0-alpha.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/android/build.gradle +70 -12
- package/android/src/main/java/com/reactnativehmssdk/HMSAudioshareActivity.kt +8 -8
- package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayer.kt +38 -12
- package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayerManagerImpl.kt +185 -0
- package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +20 -10
- package/android/src/main/java/com/reactnativehmssdk/{HMSManager.kt → HMSManagerImpl.kt} +28 -111
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +3 -3
- package/android/src/main/java/com/reactnativehmssdk/HMSReactNativeEvent.kt +29 -0
- package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManagerImpl.kt +119 -0
- package/android/src/main/java/com/reactnativehmssdk/HMSView.kt +33 -5
- package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +9 -9
- package/android/src/main/java/com/reactnativehmssdk/HmssdkPackage.kt +42 -3
- package/android/src/newarch/java/com/reactnativehmssdk/HMSHLSPlayerManager.kt +128 -0
- package/android/src/newarch/java/com/reactnativehmssdk/HMSManager.kt +332 -0
- package/android/src/newarch/java/com/reactnativehmssdk/HMSSDKViewManager.kt +102 -0
- package/android/src/oldarch/java/com/reactnativehmssdk/HMSHLSPlayerManager.kt +61 -0
- package/android/src/oldarch/java/com/reactnativehmssdk/HMSManager.kt +351 -0
- package/android/src/oldarch/java/com/reactnativehmssdk/HMSSDKViewManager.kt +87 -0
- package/ios/HMSHLSPlayerComponentView.mm +325 -0
- package/ios/HMSHLSPlayerManager.m +10 -0
- package/ios/HMSHLSPlayerManager.swift +91 -79
- package/ios/HMSManager.m +13 -0
- package/ios/HMSManager.mm +365 -0
- package/ios/HMSManager.swift +109 -103
- package/ios/HMSView.m +9 -0
- package/ios/HMSView.swift +44 -14
- package/ios/HMSViewComponentView.mm +229 -0
- package/lib/commonjs/classes/HmsView.js +45 -48
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js +46 -26
- package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
- package/lib/commonjs/components/HMSHLSPlayer/RCTHMSHLSPlayer.js +5 -4
- package/lib/commonjs/components/HMSHLSPlayer/RCTHMSHLSPlayer.js.map +1 -1
- package/lib/commonjs/modules/HMSManagerModule.js +3 -10
- package/lib/commonjs/modules/HMSManagerModule.js.map +1 -1
- package/lib/commonjs/specs/HMSHLSPlayerNativeComponent.js +75 -0
- package/lib/commonjs/specs/HMSHLSPlayerNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/HMSViewNativeComponent.js +55 -0
- package/lib/commonjs/specs/HMSViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/NativeHMSManager.js +38 -0
- package/lib/commonjs/specs/NativeHMSManager.js.map +1 -0
- package/lib/module/classes/HmsView.js +46 -49
- package/lib/module/classes/HmsView.js.map +1 -1
- package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js +48 -28
- package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
- package/lib/module/components/HMSHLSPlayer/RCTHMSHLSPlayer.js +3 -3
- package/lib/module/components/HMSHLSPlayer/RCTHMSHLSPlayer.js.map +1 -1
- package/lib/module/modules/HMSManagerModule.js +1 -9
- package/lib/module/modules/HMSManagerModule.js.map +1 -1
- package/lib/module/specs/HMSHLSPlayerNativeComponent.js +69 -0
- package/lib/module/specs/HMSHLSPlayerNativeComponent.js.map +1 -0
- package/lib/module/specs/HMSViewNativeComponent.js +49 -0
- package/lib/module/specs/HMSViewNativeComponent.js.map +1 -0
- package/lib/module/specs/NativeHMSManager.js +33 -0
- package/lib/module/specs/NativeHMSManager.js.map +1 -0
- package/lib/typescript/components/HMSHLSPlayer/RCTHMSHLSPlayer.d.ts +6 -9
- package/lib/typescript/specs/HMSHLSPlayerNativeComponent.d.ts +115 -0
- package/lib/typescript/specs/HMSViewNativeComponent.d.ts +97 -0
- package/lib/typescript/specs/NativeHMSManager.d.ts +147 -0
- package/package.json +16 -1
- package/react-native-hms.podspec +43 -0
- package/src/classes/HmsView.tsx +60 -78
- package/src/components/HMSHLSPlayer/HMSHLSPlayer.tsx +62 -128
- package/src/components/HMSHLSPlayer/RCTHMSHLSPlayer.ts +8 -13
- package/src/modules/HMSManagerModule.ts +1 -14
- package/src/specs/HMSHLSPlayerNativeComponent.ts +203 -0
- package/src/specs/HMSViewNativeComponent.ts +119 -0
- package/src/specs/NativeHMSManager.ts +307 -0
- package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayerManager.kt +0 -144
- package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +0 -111
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
//
|
|
2
|
+
// HMSHLSPlayerComponentView.mm
|
|
3
|
+
//
|
|
4
|
+
// Fabric component view for `<HMSHLSPlayer />` — the native HLS player.
|
|
5
|
+
//
|
|
6
|
+
// Phase 1 / 1B group 3 of the New Architecture migration. Sibling to
|
|
7
|
+
// `HMSViewComponentView.mm` (1B group 2) — same architecture pattern,
|
|
8
|
+
// bigger surface (3 props + 13 imperative commands + 3 events).
|
|
9
|
+
//
|
|
10
|
+
// Architecture overview:
|
|
11
|
+
// - `HMSHLSPlayerComponentView` (this file) is the Fabric wrapper:
|
|
12
|
+
// conforms to the generated `RCTHMSHLSPlayerViewProtocol`,
|
|
13
|
+
// hosts the existing Swift `HMSHLSPlayer` UIView, dispatches
|
|
14
|
+
// props / commands / events between Fabric and the Swift view.
|
|
15
|
+
// - The Swift class itself is unchanged — same player logic, same
|
|
16
|
+
// event-block props (`onDataReturned`, `onHmsHlsPlaybackEvent`,
|
|
17
|
+
// `onHmsHlsStatsEvent`).
|
|
18
|
+
//
|
|
19
|
+
// Event-emission pattern (Pattern A — block-prop interception):
|
|
20
|
+
// - The Swift `HMSHLSPlayer` UIView already exposes
|
|
21
|
+
// `@objc var on*: RCTDirectEventBlock?` for each event.
|
|
22
|
+
// - In `initWithFrame:`, we set each block to a translator block
|
|
23
|
+
// that converts the NSDictionary payload into the typed C++
|
|
24
|
+
// struct expected by the generated Fabric event emitter.
|
|
25
|
+
// - Same pattern as `HMSViewComponentView.mm`. Industry standard
|
|
26
|
+
// for migrating Swift-based RN libraries to Fabric without
|
|
27
|
+
// modifying Swift code.
|
|
28
|
+
//
|
|
29
|
+
// Note about the spec's `onHlsPlayerCuesEvent`:
|
|
30
|
+
// - The spec at src/specs/HMSHLSPlayerNativeComponent.ts declares
|
|
31
|
+
// 4 events. Today's iOS Swift class fires only 3 of them — cue
|
|
32
|
+
// events are dispatched as part of `onHmsHlsPlaybackEvent` with
|
|
33
|
+
// `event: 'ON_PLAYBACK_CUE_EVENT'`. We do NOT wire a separate
|
|
34
|
+
// `onHlsPlayerCuesEvent` translator here.
|
|
35
|
+
// - Behavior is preserved from old arch: cues continue arriving via
|
|
36
|
+
// the playback event stream. JS handlers branch on `event` field.
|
|
37
|
+
// - When/if iOS gains a separate cue-emission path, add the fourth
|
|
38
|
+
// block-intercept here.
|
|
39
|
+
//
|
|
40
|
+
|
|
41
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
42
|
+
|
|
43
|
+
#import <React/RCTViewComponentView.h>
|
|
44
|
+
#import <React/RCTConversions.h>
|
|
45
|
+
|
|
46
|
+
#import <react/renderer/components/RNHmsSpec/ComponentDescriptors.h>
|
|
47
|
+
#import <react/renderer/components/RNHmsSpec/EventEmitters.h>
|
|
48
|
+
#import <react/renderer/components/RNHmsSpec/Props.h>
|
|
49
|
+
#import <react/renderer/components/RNHmsSpec/RCTComponentViewHelpers.h>
|
|
50
|
+
|
|
51
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
52
|
+
|
|
53
|
+
// Auto-generated Swift bridging header.
|
|
54
|
+
#import "react_native_hms-Swift.h"
|
|
55
|
+
|
|
56
|
+
using namespace facebook::react;
|
|
57
|
+
|
|
58
|
+
@interface HMSHLSPlayerComponentView : RCTViewComponentView <RCTHMSHLSPlayerViewProtocol>
|
|
59
|
+
@end
|
|
60
|
+
|
|
61
|
+
@implementation HMSHLSPlayerComponentView {
|
|
62
|
+
// The Swift UIView that hosts the AVPlayerViewController and runs
|
|
63
|
+
// the HLS playback. Owned and hosted as our `contentView`.
|
|
64
|
+
HMSHLSPlayer *_view;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
#pragma mark - Component descriptor registration
|
|
68
|
+
|
|
69
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
70
|
+
return concreteComponentDescriptorProvider<HMSHLSPlayerComponentDescriptor>();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
#pragma mark - View lifecycle
|
|
74
|
+
|
|
75
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
|
76
|
+
if (self = [super initWithFrame:frame]) {
|
|
77
|
+
static const auto defaultProps = std::make_shared<const HMSHLSPlayerProps>();
|
|
78
|
+
_props = defaultProps;
|
|
79
|
+
|
|
80
|
+
// Instantiate the Swift HMSHLSPlayer view. It owns its own
|
|
81
|
+
// AVPlayerViewController, attaches to the SDK via HMSManager.shared
|
|
82
|
+
// (set in Phase 0), and emits events through its block props.
|
|
83
|
+
_view = [[HMSHLSPlayer alloc] init];
|
|
84
|
+
self.contentView = _view;
|
|
85
|
+
|
|
86
|
+
// Pattern A — block-prop interception for each of the 3 event
|
|
87
|
+
// blocks the Swift class exposes. Each block converts the
|
|
88
|
+
// NSDictionary payload into the typed C++ struct expected by
|
|
89
|
+
// the generated Fabric event emitter.
|
|
90
|
+
[self wireEventInterceptors];
|
|
91
|
+
}
|
|
92
|
+
return self;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
#pragma mark - Event interception (Pattern A)
|
|
96
|
+
|
|
97
|
+
- (void)wireEventInterceptors {
|
|
98
|
+
__weak __typeof(self) weakSelf = self;
|
|
99
|
+
|
|
100
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
101
|
+
// onDataReturned — request-response for the 3 commands that need
|
|
102
|
+
// async results: areClosedCaptionSupported, isClosedCaptionEnabled,
|
|
103
|
+
// getPlayerDurationDetails. Matched to in-flight JS promises by
|
|
104
|
+
// `requestId`.
|
|
105
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
106
|
+
_view.onDataReturned = ^(NSDictionary *body) {
|
|
107
|
+
__strong __typeof(weakSelf) strongSelf = weakSelf;
|
|
108
|
+
if (!strongSelf || !strongSelf->_eventEmitter) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
auto emitter = std::dynamic_pointer_cast<HMSHLSPlayerEventEmitter const>(
|
|
112
|
+
strongSelf->_eventEmitter);
|
|
113
|
+
if (!emitter) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
HMSHLSPlayerEventEmitter::OnDataReturned event = {};
|
|
117
|
+
if (body[@"requestId"]) {
|
|
118
|
+
event.requestId = [body[@"requestId"] intValue];
|
|
119
|
+
}
|
|
120
|
+
// Swift packages the result/error under @"data" today; pass
|
|
121
|
+
// straight through as a JSON-stringified blob (Phase 1 Object-typed
|
|
122
|
+
// convention — Phase 2 will narrow).
|
|
123
|
+
if (body[@"data"]) {
|
|
124
|
+
NSError *jsonError = nil;
|
|
125
|
+
NSData *jsonData =
|
|
126
|
+
[NSJSONSerialization dataWithJSONObject:body[@"data"]
|
|
127
|
+
options:0
|
|
128
|
+
error:&jsonError];
|
|
129
|
+
if (jsonError) {
|
|
130
|
+
RCTLogWarn(@"[HMSHLSPlayer] Failed to serialize event data: %@", jsonError);
|
|
131
|
+
}
|
|
132
|
+
if (jsonData) {
|
|
133
|
+
NSString *jsonString = [[NSString alloc] initWithData:jsonData
|
|
134
|
+
encoding:NSUTF8StringEncoding];
|
|
135
|
+
if (jsonString) {
|
|
136
|
+
event.result = [jsonString UTF8String];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
emitter->onDataReturned(event);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
144
|
+
// onHmsHlsPlaybackEvent — playback state changes, cues, failures,
|
|
145
|
+
// resolution changes. Swift emits a `{event, data}` shape; we pack
|
|
146
|
+
// `data` as a stringified JSON blob per the Phase 1 convention.
|
|
147
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
148
|
+
_view.onHmsHlsPlaybackEvent = ^(NSDictionary *body) {
|
|
149
|
+
__strong __typeof(weakSelf) strongSelf = weakSelf;
|
|
150
|
+
if (!strongSelf || !strongSelf->_eventEmitter) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
auto emitter = std::dynamic_pointer_cast<HMSHLSPlayerEventEmitter const>(
|
|
154
|
+
strongSelf->_eventEmitter);
|
|
155
|
+
if (!emitter) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
HMSHLSPlayerEventEmitter::OnHmsHlsPlaybackEvent event = {};
|
|
159
|
+
if ([body[@"event"] isKindOfClass:[NSString class]]) {
|
|
160
|
+
event.event = [body[@"event"] UTF8String];
|
|
161
|
+
}
|
|
162
|
+
if (body[@"data"]) {
|
|
163
|
+
NSError *jsonError = nil;
|
|
164
|
+
NSData *jsonData =
|
|
165
|
+
[NSJSONSerialization dataWithJSONObject:body[@"data"]
|
|
166
|
+
options:0
|
|
167
|
+
error:&jsonError];
|
|
168
|
+
if (jsonError) {
|
|
169
|
+
RCTLogWarn(@"[HMSHLSPlayer] Failed to serialize event data: %@", jsonError);
|
|
170
|
+
}
|
|
171
|
+
if (jsonData) {
|
|
172
|
+
NSString *jsonString = [[NSString alloc] initWithData:jsonData
|
|
173
|
+
encoding:NSUTF8StringEncoding];
|
|
174
|
+
if (jsonString) {
|
|
175
|
+
event.data = [jsonString UTF8String];
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
emitter->onHmsHlsPlaybackEvent(event);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
183
|
+
// onHmsHlsStatsEvent — bandwidth, dropped frames, bitrate, etc.
|
|
184
|
+
// Fired periodically when `enableStats=true`.
|
|
185
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
186
|
+
_view.onHmsHlsStatsEvent = ^(NSDictionary *body) {
|
|
187
|
+
__strong __typeof(weakSelf) strongSelf = weakSelf;
|
|
188
|
+
if (!strongSelf || !strongSelf->_eventEmitter) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
auto emitter = std::dynamic_pointer_cast<HMSHLSPlayerEventEmitter const>(
|
|
192
|
+
strongSelf->_eventEmitter);
|
|
193
|
+
if (!emitter) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
HMSHLSPlayerEventEmitter::OnHmsHlsStatsEvent event = {};
|
|
197
|
+
if ([body[@"event"] isKindOfClass:[NSString class]]) {
|
|
198
|
+
event.event = [body[@"event"] UTF8String];
|
|
199
|
+
}
|
|
200
|
+
if (body[@"data"]) {
|
|
201
|
+
NSError *jsonError = nil;
|
|
202
|
+
NSData *jsonData =
|
|
203
|
+
[NSJSONSerialization dataWithJSONObject:body[@"data"]
|
|
204
|
+
options:0
|
|
205
|
+
error:&jsonError];
|
|
206
|
+
if (jsonError) {
|
|
207
|
+
RCTLogWarn(@"[HMSHLSPlayer] Failed to serialize event data: %@", jsonError);
|
|
208
|
+
}
|
|
209
|
+
if (jsonData) {
|
|
210
|
+
NSString *jsonString = [[NSString alloc] initWithData:jsonData
|
|
211
|
+
encoding:NSUTF8StringEncoding];
|
|
212
|
+
if (jsonString) {
|
|
213
|
+
event.data = [jsonString UTF8String];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
emitter->onHmsHlsStatsEvent(event);
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
#pragma mark - Prop dispatch
|
|
222
|
+
|
|
223
|
+
- (void)updateProps:(Props::Shared const &)props
|
|
224
|
+
oldProps:(Props::Shared const &)oldProps {
|
|
225
|
+
const auto &oldViewProps =
|
|
226
|
+
*std::static_pointer_cast<HMSHLSPlayerProps const>(_props);
|
|
227
|
+
const auto &newViewProps =
|
|
228
|
+
*std::static_pointer_cast<HMSHLSPlayerProps const>(props);
|
|
229
|
+
|
|
230
|
+
// url (string) — setting this triggers Swift's `play(url)` via didSet
|
|
231
|
+
if (oldViewProps.url != newViewProps.url) {
|
|
232
|
+
_view.url = RCTNSStringFromString(newViewProps.url);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// enableStats (bool) — toggles the Swift class's stats timer
|
|
236
|
+
if (oldViewProps.enableStats != newViewProps.enableStats) {
|
|
237
|
+
_view.enableStats = newViewProps.enableStats;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// enableControls (bool) — toggles AVPlayerViewController's controls UI
|
|
241
|
+
if (oldViewProps.enableControls != newViewProps.enableControls) {
|
|
242
|
+
_view.enableControls = newViewProps.enableControls;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
[super updateProps:props oldProps:oldProps];
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
#pragma mark - Imperative commands
|
|
249
|
+
|
|
250
|
+
// Generic command dispatcher. The `RCTHMSHLSPlayerHandleCommand` helper
|
|
251
|
+
// is generated by Codegen and dispatches to the typed methods below
|
|
252
|
+
// based on the command name from the JS spec.
|
|
253
|
+
- (void)handleCommand:(NSString const *)commandName args:(NSArray const *)args {
|
|
254
|
+
RCTHMSHLSPlayerHandleCommand(self, commandName, args);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// 13 commands matching src/specs/HMSHLSPlayerNativeComponent.ts.
|
|
258
|
+
// Each forwards directly to the corresponding method on the Swift
|
|
259
|
+
// `HMSHLSPlayer` UIView.
|
|
260
|
+
|
|
261
|
+
- (void)play:(NSString *)url {
|
|
262
|
+
// Spec convention: empty string means "use the URL prop"
|
|
263
|
+
[_view play:url.length > 0 ? url : nil];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
- (void)stop {
|
|
267
|
+
[_view stop];
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
- (void)pause {
|
|
271
|
+
[_view pause];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
- (void)resume {
|
|
275
|
+
[_view resume];
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
- (void)seekToLivePosition {
|
|
279
|
+
[_view seekToLivePosition];
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
- (void)seekForward:(double)seconds {
|
|
283
|
+
[_view seekForward:seconds];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
- (void)seekBackward:(double)seconds {
|
|
287
|
+
[_view seekBackward:seconds];
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
- (void)setVolume:(NSInteger)level {
|
|
291
|
+
[_view setVolume:(int)level];
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
- (void)areClosedCaptionSupported:(NSInteger)requestId {
|
|
295
|
+
[_view areClosedCaptionSupportedWithRequestId:(NSUInteger)requestId];
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
- (void)isClosedCaptionEnabled:(NSInteger)requestId {
|
|
299
|
+
[_view isClosedCaptionEnabledWithRequestId:(NSUInteger)requestId];
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
- (void)enableClosedCaption {
|
|
303
|
+
[_view enableClosedCaption];
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
- (void)disableClosedCaption {
|
|
307
|
+
[_view disableClosedCaption];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
- (void)getPlayerDurationDetails:(NSInteger)requestId {
|
|
311
|
+
[_view getPlayerDurationDetailsWithRequestId:(NSUInteger)requestId];
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
@end
|
|
315
|
+
|
|
316
|
+
#pragma mark - Plugin registration
|
|
317
|
+
|
|
318
|
+
// Public C function that the Fabric component-views plugin registry
|
|
319
|
+
// calls (via RCTFabricComponentsPlugins) to register this class as
|
|
320
|
+
// the implementation of `<HMSHLSPlayer />`.
|
|
321
|
+
Class<RCTComponentViewProtocol> HMSHLSPlayerCls(void) {
|
|
322
|
+
return HMSHLSPlayerComponentView.class;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
#import "React/RCTViewManager.h"
|
|
3
3
|
#import <Foundation/Foundation.h>
|
|
4
4
|
|
|
5
|
+
// Under the New Architecture, `<HMSHLSPlayer />` is rendered via the
|
|
6
|
+
// Fabric component view in HMSHLSPlayerComponentView.mm. The legacy
|
|
7
|
+
// paper RCT_EXTERN_MODULE + RCT_EXPORT_VIEW_PROPERTY + RCT_EXTERN_METHOD
|
|
8
|
+
// declarations below are only used in old-arch / interop mode, so we
|
|
9
|
+
// guard the whole block with #if !RCT_NEW_ARCH_ENABLED to prevent
|
|
10
|
+
// double-registration.
|
|
11
|
+
#if !RCT_NEW_ARCH_ENABLED
|
|
12
|
+
|
|
5
13
|
@interface RCT_EXTERN_MODULE(HMSHLSPlayerManager, RCTViewManager)
|
|
6
14
|
|
|
7
15
|
RCT_EXPORT_VIEW_PROPERTY(url, NSString);
|
|
@@ -26,3 +34,5 @@ RCT_EXTERN_METHOD(disableClosedCaption:(nonnull NSNumber *)node)
|
|
|
26
34
|
RCT_EXTERN_METHOD(getPlayerDurationDetails:(nonnull NSNumber *)node requestId:(nonnull NSNumber *)requestId)
|
|
27
35
|
|
|
28
36
|
@end
|
|
37
|
+
|
|
38
|
+
#endif // !RCT_NEW_ARCH_ENABLED
|