@byteplus/react-native-live-pull 1.5.2-rc.2 → 1.5.2-rc.4

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.
@@ -32,17 +32,8 @@
32
32
  }
33
33
 
34
34
  - (NSDictionary *)callApiSync:(NSDictionary *)args {
35
- __block NSDictionary *result = nil;
36
- void (^work)(void) = ^{
37
- [self newApiEngine];
38
- result = [self.volcApiEngine callApi:args];
39
- };
40
- if ([NSThread isMainThread]) {
41
- work();
42
- } else {
43
- dispatch_sync(dispatch_get_main_queue(), work);
44
- }
45
- return result;
35
+ [self newApiEngine];
36
+ return [self.volcApiEngine callApi:args];
46
37
  }
47
38
 
48
39
  //callback 是OC的回调函数,外层需要进一步封装,接收一个NSDictionary类型的参数
@@ -46,13 +46,18 @@
46
46
  - (void) insertSubview:(UIView *)view atIndex:(NSInteger)index {
47
47
  // NSLog(@"insert playview, self bounds=%f x %f", self.bounds.size.width, self.bounds.size.height);
48
48
  // NSLog(@"insert playview, view frame=%f x %f", view.frame.size.width, view.frame.size.height);
49
+
50
+ dispatch_async(dispatch_get_main_queue(), ^{
49
51
  [super insertSubview:view atIndex:index];
50
52
  [self setSubViewLayout:view];
53
+ });
51
54
  }
52
55
 
53
56
  - (void) addSubview:(UIView *)view {
57
+ dispatch_async(dispatch_get_main_queue(), ^{
54
58
  [super addSubview:view];
55
59
  [self setSubViewLayout:view];
60
+ });
56
61
  }
57
62
 
58
63
  // 设置 Auto Layout,确保 subView 始终匹配 view 尺寸
@@ -52,17 +52,11 @@ NSString *const kObserverKey = @"pip-observer";
52
52
  if (@available(iOS 14.2, *)) {
53
53
  _canStartPictureInPictureAutomaticallyFromInline = NO;
54
54
  }
55
- // 监听从通知中心/后台返回活跃状态
56
- [[NSNotificationCenter defaultCenter] addObserver:self
57
- selector:@selector(handleAppDidBecomeActive)
58
- name:UIApplicationDidBecomeActiveNotification
59
- object:nil];
60
55
  }
61
56
  return self;
62
57
  }
63
58
 
64
59
  - (void)dealloc {
65
- [[NSNotificationCenter defaultCenter] removeObserver:self];
66
60
  [self disableVideoFrameObserver];
67
61
  [self stopPlaybackStateTimer];
68
62
 
@@ -74,31 +68,6 @@ NSString *const kObserverKey = @"pip-observer";
74
68
  [[VeLivePlayerMultiObserver sharedInstance] removeObserver:kObserverKey];
75
69
  }
76
70
 
77
- - (void)handleAppDidBecomeActive {
78
-
79
- if (self.pipController && [self.pipController pictureInPictureController]) {
80
- // 只有在 PIP 开启状态下才需要重连,避免干扰正常播放
81
- AVPictureInPictureController *controller =
82
- [self.pipController pictureInPictureController];
83
- if (controller.isPictureInPictureActive) {
84
- __weak typeof(self) weakSelf = self;
85
- dispatch_async(dispatch_get_main_queue(), ^{
86
- __strong typeof(weakSelf) strongSelf = weakSelf;
87
- if (!strongSelf) return;
88
- // 强制重新绑定 ContentView。
89
- // 这会诱导底层重新创建 IOSurface,修复内核日志中的 SID: 0x0 报错。
90
- [strongSelf.pipController setContentView:strongSelf.contentView completion:^{
91
- __strong typeof(weakSelf) strongSelf = weakSelf;
92
- if (!strongSelf) return;
93
- // 刷新播放状态,确保画面立即同步
94
- [[strongSelf.pipController pictureInPictureController] invalidatePlaybackState];
95
- NSLog(@"PIP: App active, re-bound Surface to fix potential corruption.");
96
- }];
97
- });
98
- }
99
- }
100
- }
101
-
102
71
  // Start playback state refresh timer
103
72
  - (void)startPlaybackStateTimer {
104
73
  [self stopPlaybackStateTimer];
@@ -276,7 +245,7 @@ NSString *const kObserverKey = @"pip-observer";
276
245
  self.enableVideoObserver = YES;
277
246
  [self.player
278
247
  enableVideoFrameObserver:YES
279
- pixelFormat:VeLivePlayerPixelFormatNV12
248
+ pixelFormat:VeLivePlayerPixelFormatBGRA32
280
249
  bufferType:VeLivePlayerVideoBufferTypeSampleBuffer];
281
250
  [[VeLivePlayerMultiObserver sharedInstance] removeObserver:kObserverKey];
282
251
  [[VeLivePlayerMultiObserver sharedInstance] addObserver:kObserverKey
@@ -403,20 +372,6 @@ NSString *const kObserverKey = @"pip-observer";
403
372
  - (void)onRenderVideoFrame:(TVLManager *_Nonnull)player
404
373
  videoFrame:(VeLivePlayerVideoFrame *_Nonnull)videoFrame {
405
374
  @autoreleasepool {
406
- UIApplicationState state = [UIApplication sharedApplication].applicationState;
407
-
408
- // 【核心修正】
409
- // 1. 如果是 Active (前台),正常推流。
410
- // 2. 如果是 Background (正常画中画/后台),正常推流。
411
- // 3. 【拦截】只有当状态是 Inactive 时:
412
- // 这通常对应“下拉通知中心”、“拉下控制中心”或“系统弹窗”遮挡。
413
- // 此时日志中的 SID: 0x0 报错最集中,必须拦截推流以保护内核句柄。
414
- NSLog(@"PIP: Application state is %ld", (long)state);
415
- if (state == UIApplicationStateInactive) {
416
- // 如果正在画中画过程中,且 App 处于非活跃(被遮挡)状态,暂时丢弃这一帧
417
- return;
418
- }
419
-
420
375
  // Ensure pipController exists and is valid, avoid processing buffer during
421
376
  // destruction
422
377
  if (!self.pipController || !self.enableVideoObserver) {
@@ -515,4 +470,4 @@ NSString *const kObserverKey = @"pip-observer";
515
470
  }
516
471
  }
517
472
 
518
- @end
473
+ @end
@@ -6183,6 +6183,7 @@ var TVLManager = function () {
6183
6183
  var _setEnableIgnoreAudioInterruption_decorators;
6184
6184
  var _setAllowsVideoRendering_decorators;
6185
6185
  var _addExtraHttpRequestHeadersByUser_decorators;
6186
+ var _setOptionValue_decorators;
6186
6187
  _classThis = /** @class */ (function () {
6187
6188
  function TVLManager_1() {
6188
6189
  /** {zh}
@@ -6730,6 +6731,21 @@ var TVLManager = function () {
6730
6731
  TVLManager_1.prototype.addExtraHttpRequestHeadersByUser = function (headers) {
6731
6732
  throw new Error('not implement');
6732
6733
  };
6734
+ /** {zh}
6735
+ * @detail api
6736
+ * @brief 设置播放器选项值
6737
+ * @param value 选项值
6738
+ * @param identifier 选项标识符
6739
+ */
6740
+ /** {en}
6741
+ * @detail api
6742
+ * @brief Sets player option value
6743
+ * @param value Option value
6744
+ * @param identifier Option identifier
6745
+ */
6746
+ TVLManager_1.prototype.setOptionValue = function (value, identifier) {
6747
+ throw new Error('not implement');
6748
+ };
6733
6749
  return TVLManager_1;
6734
6750
  }());
6735
6751
  __setFunctionName(_classThis, "TVLManager");
@@ -6768,6 +6784,7 @@ var TVLManager = function () {
6768
6784
  _setEnableIgnoreAudioInterruption_decorators = [NativeMethodSync('setEnableIgnoreAudioInterruption:')];
6769
6785
  _setAllowsVideoRendering_decorators = [NativeMethodSync('setAllowsVideoRendering:')];
6770
6786
  _addExtraHttpRequestHeadersByUser_decorators = [NativeMethodSync('addExtraHttpRequestHeadersByUser:')];
6787
+ _setOptionValue_decorators = [NativeMethodSync('setOptionValue:forIdentifier:')];
6771
6788
  __esDecorate(_classThis, null, _static_setLogLevel_decorators, { kind: "method", name: "setLogLevel", static: true, private: false, access: { has: function (obj) { return "setLogLevel" in obj; }, get: function (obj) { return obj.setLogLevel; } }, metadata: _metadata }, null, _staticExtraInitializers);
6772
6789
  __esDecorate(_classThis, null, _static_getVersion_decorators, { kind: "method", name: "getVersion", static: true, private: false, access: { has: function (obj) { return "getVersion" in obj; }, get: function (obj) { return obj.getVersion; } }, metadata: _metadata }, null, _staticExtraInitializers);
6773
6790
  __esDecorate(_classThis, null, _init_decorators, { kind: "method", name: "init", static: false, private: false, access: { has: function (obj) { return "init" in obj; }, get: function (obj) { return obj.init; } }, metadata: _metadata }, null, _instanceExtraInitializers);
@@ -6797,6 +6814,7 @@ var TVLManager = function () {
6797
6814
  __esDecorate(_classThis, null, _setEnableIgnoreAudioInterruption_decorators, { kind: "method", name: "setEnableIgnoreAudioInterruption", static: false, private: false, access: { has: function (obj) { return "setEnableIgnoreAudioInterruption" in obj; }, get: function (obj) { return obj.setEnableIgnoreAudioInterruption; } }, metadata: _metadata }, null, _instanceExtraInitializers);
6798
6815
  __esDecorate(_classThis, null, _setAllowsVideoRendering_decorators, { kind: "method", name: "setAllowsVideoRendering", static: false, private: false, access: { has: function (obj) { return "setAllowsVideoRendering" in obj; }, get: function (obj) { return obj.setAllowsVideoRendering; } }, metadata: _metadata }, null, _instanceExtraInitializers);
6799
6816
  __esDecorate(_classThis, null, _addExtraHttpRequestHeadersByUser_decorators, { kind: "method", name: "addExtraHttpRequestHeadersByUser", static: false, private: false, access: { has: function (obj) { return "addExtraHttpRequestHeadersByUser" in obj; }, get: function (obj) { return obj.addExtraHttpRequestHeadersByUser; } }, metadata: _metadata }, null, _instanceExtraInitializers);
6817
+ __esDecorate(_classThis, null, _setOptionValue_decorators, { kind: "method", name: "setOptionValue", static: false, private: false, access: { has: function (obj) { return "setOptionValue" in obj; }, get: function (obj) { return obj.setOptionValue; } }, metadata: _metadata }, null, _instanceExtraInitializers);
6800
6818
  __esDecorate(null, null, _observer_decorators, { kind: "field", name: "observer", static: false, private: false, access: { has: function (obj) { return "observer" in obj; }, get: function (obj) { return obj.observer; }, set: function (obj, value) { obj.observer = value; } }, metadata: _metadata }, _observer_initializers, _observer_extraInitializers);
6801
6819
  __esDecorate(null, null, _playerView_decorators, { kind: "field", name: "playerView", static: false, private: false, access: { has: function (obj) { return "playerView" in obj; }, get: function (obj) { return obj.playerView; }, set: function (obj, value) { obj.playerView = value; } }, metadata: _metadata }, _playerView_initializers, _playerView_extraInitializers);
6802
6820
  __esDecorate(null, null, _volume_decorators, { kind: "field", name: "volume", static: false, private: false, access: { has: function (obj) { return "volume" in obj; }, get: function (obj) { return obj.volume; }, set: function (obj, value) { obj.volume = value; } }, metadata: _metadata }, _volume_initializers, _volume_extraInitializers);
@@ -14646,6 +14664,8 @@ function initIOSPlayer(options) {
14646
14664
  case 0:
14647
14665
  viewId = options.viewId, option = __rest(options, ["viewId"]);
14648
14666
  iosPlayer = new TVLManager();
14667
+ // 设置选项值
14668
+ iosPlayer.setOptionValue(1, 42866);
14649
14669
  player = packObject(iosPlayer, VeLivePlayer);
14650
14670
  config = new VeLivePlayerConfiguration();
14651
14671
  Object.assign(config, defaultConfig, option);
@@ -6181,6 +6181,7 @@ var TVLManager = function () {
6181
6181
  var _setEnableIgnoreAudioInterruption_decorators;
6182
6182
  var _setAllowsVideoRendering_decorators;
6183
6183
  var _addExtraHttpRequestHeadersByUser_decorators;
6184
+ var _setOptionValue_decorators;
6184
6185
  _classThis = /** @class */ (function () {
6185
6186
  function TVLManager_1() {
6186
6187
  /** {zh}
@@ -6728,6 +6729,21 @@ var TVLManager = function () {
6728
6729
  TVLManager_1.prototype.addExtraHttpRequestHeadersByUser = function (headers) {
6729
6730
  throw new Error('not implement');
6730
6731
  };
6732
+ /** {zh}
6733
+ * @detail api
6734
+ * @brief 设置播放器选项值
6735
+ * @param value 选项值
6736
+ * @param identifier 选项标识符
6737
+ */
6738
+ /** {en}
6739
+ * @detail api
6740
+ * @brief Sets player option value
6741
+ * @param value Option value
6742
+ * @param identifier Option identifier
6743
+ */
6744
+ TVLManager_1.prototype.setOptionValue = function (value, identifier) {
6745
+ throw new Error('not implement');
6746
+ };
6731
6747
  return TVLManager_1;
6732
6748
  }());
6733
6749
  __setFunctionName(_classThis, "TVLManager");
@@ -6766,6 +6782,7 @@ var TVLManager = function () {
6766
6782
  _setEnableIgnoreAudioInterruption_decorators = [NativeMethodSync('setEnableIgnoreAudioInterruption:')];
6767
6783
  _setAllowsVideoRendering_decorators = [NativeMethodSync('setAllowsVideoRendering:')];
6768
6784
  _addExtraHttpRequestHeadersByUser_decorators = [NativeMethodSync('addExtraHttpRequestHeadersByUser:')];
6785
+ _setOptionValue_decorators = [NativeMethodSync('setOptionValue:forIdentifier:')];
6769
6786
  __esDecorate(_classThis, null, _static_setLogLevel_decorators, { kind: "method", name: "setLogLevel", static: true, private: false, access: { has: function (obj) { return "setLogLevel" in obj; }, get: function (obj) { return obj.setLogLevel; } }, metadata: _metadata }, null, _staticExtraInitializers);
6770
6787
  __esDecorate(_classThis, null, _static_getVersion_decorators, { kind: "method", name: "getVersion", static: true, private: false, access: { has: function (obj) { return "getVersion" in obj; }, get: function (obj) { return obj.getVersion; } }, metadata: _metadata }, null, _staticExtraInitializers);
6771
6788
  __esDecorate(_classThis, null, _init_decorators, { kind: "method", name: "init", static: false, private: false, access: { has: function (obj) { return "init" in obj; }, get: function (obj) { return obj.init; } }, metadata: _metadata }, null, _instanceExtraInitializers);
@@ -6795,6 +6812,7 @@ var TVLManager = function () {
6795
6812
  __esDecorate(_classThis, null, _setEnableIgnoreAudioInterruption_decorators, { kind: "method", name: "setEnableIgnoreAudioInterruption", static: false, private: false, access: { has: function (obj) { return "setEnableIgnoreAudioInterruption" in obj; }, get: function (obj) { return obj.setEnableIgnoreAudioInterruption; } }, metadata: _metadata }, null, _instanceExtraInitializers);
6796
6813
  __esDecorate(_classThis, null, _setAllowsVideoRendering_decorators, { kind: "method", name: "setAllowsVideoRendering", static: false, private: false, access: { has: function (obj) { return "setAllowsVideoRendering" in obj; }, get: function (obj) { return obj.setAllowsVideoRendering; } }, metadata: _metadata }, null, _instanceExtraInitializers);
6797
6814
  __esDecorate(_classThis, null, _addExtraHttpRequestHeadersByUser_decorators, { kind: "method", name: "addExtraHttpRequestHeadersByUser", static: false, private: false, access: { has: function (obj) { return "addExtraHttpRequestHeadersByUser" in obj; }, get: function (obj) { return obj.addExtraHttpRequestHeadersByUser; } }, metadata: _metadata }, null, _instanceExtraInitializers);
6815
+ __esDecorate(_classThis, null, _setOptionValue_decorators, { kind: "method", name: "setOptionValue", static: false, private: false, access: { has: function (obj) { return "setOptionValue" in obj; }, get: function (obj) { return obj.setOptionValue; } }, metadata: _metadata }, null, _instanceExtraInitializers);
6798
6816
  __esDecorate(null, null, _observer_decorators, { kind: "field", name: "observer", static: false, private: false, access: { has: function (obj) { return "observer" in obj; }, get: function (obj) { return obj.observer; }, set: function (obj, value) { obj.observer = value; } }, metadata: _metadata }, _observer_initializers, _observer_extraInitializers);
6799
6817
  __esDecorate(null, null, _playerView_decorators, { kind: "field", name: "playerView", static: false, private: false, access: { has: function (obj) { return "playerView" in obj; }, get: function (obj) { return obj.playerView; }, set: function (obj, value) { obj.playerView = value; } }, metadata: _metadata }, _playerView_initializers, _playerView_extraInitializers);
6800
6818
  __esDecorate(null, null, _volume_decorators, { kind: "field", name: "volume", static: false, private: false, access: { has: function (obj) { return "volume" in obj; }, get: function (obj) { return obj.volume; }, set: function (obj, value) { obj.volume = value; } }, metadata: _metadata }, _volume_initializers, _volume_extraInitializers);
@@ -14644,6 +14662,8 @@ function initIOSPlayer(options) {
14644
14662
  case 0:
14645
14663
  viewId = options.viewId, option = __rest(options, ["viewId"]);
14646
14664
  iosPlayer = new TVLManager();
14665
+ // 设置选项值
14666
+ iosPlayer.setOptionValue(1, 42866);
14647
14667
  player = packObject(iosPlayer, VeLivePlayer);
14648
14668
  config = new VeLivePlayerConfiguration();
14649
14669
  Object.assign(config, defaultConfig, option);
@@ -292,4 +292,12 @@ export declare class TVLManager {
292
292
  setEnableIgnoreAudioInterruption(enable: BOOL): void;
293
293
  setAllowsVideoRendering(enable: BOOL): void;
294
294
  addExtraHttpRequestHeadersByUser(headers: NSDictionary): void;
295
+
296
+ /** {en}
297
+ * @detail api
298
+ * @brief Sets player option value
299
+ * @param value Option value
300
+ * @param identifier Option identifier
301
+ */
302
+ setOptionValue(value: id, identifier: int): void;
295
303
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byteplus/react-native-live-pull",
3
- "version": "1.5.2-rc.2",
3
+ "version": "1.5.2-rc.4",
4
4
  "peerDependencies": {
5
5
  "react": "*",
6
6
  "react-native": "*"