@byteplus/react-native-live-pull 1.1.3-rc.3 → 1.2.0-rc.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 (31) hide show
  1. package/android/build.gradle +2 -2
  2. package/android/src/main/java/com/volcengine/velive/rn/pull/ClassHelper.java +15 -0
  3. package/android/src/main/java/com/volcengine/velive/rn/pull/NativeVariableManager.java +1 -1
  4. package/android/src/main/java/com/volcengine/velive/rn/pull/VolcLiveModule.java +2 -0
  5. package/android/src/main/java/com/volcengine/velive/rn/pull/autogen/MethodSignature.java +66 -77
  6. package/android/src/main/java/com/volcengine/velive/rn/pull/pictureInpicture/FloatingWindowService.java +79 -15
  7. package/ios/VeLivePlayerMultiObserver.h +3 -2
  8. package/ios/VeLivePlayerMultiObserver.m +2 -2
  9. package/ios/include/react-native-velive-pull.modulemap +4 -0
  10. package/ios/pictureInpicture/PictureInPictureManager.h +21 -1
  11. package/ios/pictureInpicture/PictureInPictureManager.m +254 -141
  12. package/lib/commonjs/index.js +4455 -1648
  13. package/lib/module/index.js +4455 -1648
  14. package/lib/typescript/codegen/android/api.d.ts +51 -43
  15. package/lib/typescript/codegen/android/callback.d.ts +166 -0
  16. package/lib/typescript/codegen/android/errorcode.d.ts +123 -2
  17. package/lib/typescript/codegen/android/keytype.d.ts +501 -13
  18. package/lib/typescript/codegen/ios/api.d.ts +232 -16
  19. package/lib/typescript/codegen/ios/callback.d.ts +137 -1
  20. package/lib/typescript/codegen/ios/errorcode.d.ts +104 -0
  21. package/lib/typescript/codegen/ios/keytype.d.ts +460 -6
  22. package/lib/typescript/codegen/pack/api.d.ts +66 -57
  23. package/lib/typescript/codegen/pack/callback.d.ts +45 -21
  24. package/lib/typescript/codegen/pack/errorcode.d.ts +45 -15
  25. package/lib/typescript/codegen/pack/keytype.d.ts +388 -114
  26. package/lib/typescript/core/api.d.ts +13 -0
  27. package/lib/typescript/core/keytype.d.ts +18 -2
  28. package/package.json +1 -1
  29. package/react-native-velive-pull.podspec +12 -3
  30. package/ios/pictureInpicture/VeLivePictureInPictureController.h +0 -207
  31. package/ios/pictureInpicture/VeLivePictureInPictureController.m +0 -3393
@@ -96,6 +96,19 @@ declare module '../codegen/pack/api' {
96
96
  * @order 7
97
97
  */
98
98
  setEnableIgnoreAudioInterruption(enable: boolean): void;
99
+ /**
100
+ * {zh}
101
+ * @brief 添加用户自定义的HTTP请求头
102
+ * @param headers 用户自定义的HTTP请求头
103
+ * @order 8
104
+ */
105
+ /**
106
+ * {en}
107
+ * @brief Add user-defined HTTP request headers
108
+ * @param headers User-defined HTTP request headers
109
+ * @order 8
110
+ */
111
+ addExtraHttpRequestHeadersByUser(headers: Record<string, string>): void;
99
112
  }
100
113
  }
101
114
  export { VeLivePlayer };
@@ -1,17 +1,33 @@
1
1
  declare module '../codegen/pack/keytype' {
2
+ interface VeLivePlayerStreamData {
3
+
4
+ /** {en}
5
+ * @brief A list of main stream addresses. See [VeLivePlayerStream](#VeLivePlayerStreamData-VeLivePlayerStream) for details.
6
+ *
7
+ */
8
+ get mainStreamList(): VeLivePlayerStream[];
9
+ set mainStreamList(value: VeLivePlayerStream[]);
10
+
11
+ /** {en}
12
+ * @brief A list of backup stream addresses. See [VeLivePlayerStream](#VeLivePlayerStreamData-VeLivePlayerStream) for details.
13
+ *
14
+ */
15
+ get backupStreamList(): VeLivePlayerStream[];
16
+ set backupStreamList(value: VeLivePlayerStream[]);
17
+ }
2
18
  interface VeLivePlayerStatistics {
3
19
 
4
20
  /** {en}
5
21
  * @brief The video format.
6
22
  *
7
23
  */
8
- format: VeLivePlayerFormat;
24
+ get format(): VeLivePlayerFormat;
9
25
 
10
26
  /** {en}
11
27
  * @brief The transmission protocol of the live stream.
12
28
  *
13
29
  */
14
- protocol: VeLivePlayerProtocol;
30
+ get protocol(): VeLivePlayerProtocol;
15
31
  }
16
32
  }
17
33
  export { VeLivePlayerAudioBufferType, VeLivePlayerAudioFrame, VeLivePlayerConfiguration, VeLivePlayerFillMode, VeLivePlayerFormat, VeLivePlayerLogLevel, VeLivePlayerMirror, VeLivePlayerPixelFormat, VeLivePlayerProtocol, VeLivePlayerResolution, VeLivePlayerResolutionSwitchReason, VeLivePlayerRotation, VeLivePlayerStatistics, VeLivePlayerStatus, VeLivePlayerStream, VeLivePlayerStreamData, VeLivePlayerStreamType, VeLivePlayerVideoBufferType, VeLivePlayerVideoFrame, } from '../codegen/pack/keytype';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byteplus/react-native-live-pull",
3
- "version": "1.1.3-rc.3",
3
+ "version": "1.2.0-rc.0",
4
4
  "peerDependencies": {
5
5
  "react": "*",
6
6
  "react-native": "*"
@@ -15,6 +15,15 @@ Pod::Spec.new do |s|
15
15
  s.source = { :git => "https://github.com/volcengine/volcengine-specs.git", :tag => "#{s.version}" }
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm}"
18
+ s.static_framework = true
19
+ s.preserve_paths = ['ios/include/react-native-velive-pull.modulemap']
20
+
21
+ s.pod_target_xcconfig = {
22
+ 'DEFINES_MODULE' => 'YES',
23
+ 'SWIFT_INCLUDE_PATHS' => '$(PODS_TARGET_SRCROOT)/ios/include',
24
+ 'MODULEMAP_FILE' => '$(PODS_TARGET_SRCROOT)/ios/include/react-native-velive-pull.modulemap',
25
+ 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES'
26
+ }
18
27
 
19
28
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20
29
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
@@ -39,7 +48,7 @@ Pod::Spec.new do |s|
39
48
  end
40
49
  end
41
50
 
42
- s.dependency 'VolcApiEngine', '1.2.3'
43
- s.dependency 'TTSDKFramework/Core', '1.41.300.7-premium'
44
- s.dependency 'TTSDKFramework/LivePull-RTS', '1.41.300.7-premium'
51
+ s.dependency 'VolcApiEngine', '1.6.2'
52
+ s.dependency 'TTSDKFramework/Core', '1.46.300.1-premium'
53
+ s.dependency 'TTSDKFramework/LivePull-RTS', '1.46.300.1-premium'
45
54
  end
@@ -1,207 +0,0 @@
1
-
2
- //
3
- // VeLivePictureInPictureController.h
4
- // VELLiveDemo
5
- //
6
- // Created by Bytedance on 2023-06-09
7
- //
8
- //
9
-
10
- #import <UIKit/UIKit.h>
11
- #import <AVKit/AVKit.h>
12
- #import <AVFoundation/AVFoundation.h>
13
-
14
- // {zh} 是否开启 iOS 15 以下画中画支持 {en} Whether to enable PIP support below iOS 15
15
- // {zh} 会调用未公开 API, 可能会有审核风险,请业务自行决定是否开启 {en} The undisclosed API will be called, and there may be audit risks. Please decide whether to open it or not.
16
- #define VEL_PICTURE_IN_PICTURE_ENABLE_PIP_BELOW_IOS_15 0
17
-
18
- #ifndef VeLivePipLog
19
- # ifdef VELLogDebug
20
- # define VeLivePipLog(tag, fmt, ...) VELLogDebug(tag, fmt, ##__VA_ARGS__)
21
- # else
22
- # define VeLivePipLog(tag, fmt, ...) NSLog((@"[%@] [%s] [%d] " fmt), tag, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
23
- # endif
24
- #endif
25
-
26
- #ifndef VeLivePipError
27
- # define VeLivePipError(c, des) [NSError errorWithDomain:VeLivePictureInPictureErrorDomain code:c userInfo:@{NSLocalizedDescriptionKey : des}]
28
- #endif
29
-
30
- NS_ASSUME_NONNULL_BEGIN
31
-
32
- @class VeLivePictureInPictureController;
33
- @protocol VeLivePictureInPictureDelegate <NSObject>
34
- @optional
35
- // {zh} 画中画准备完成 {en} PIP ready to complete
36
- - (void)pictureInPictureIsReady:(VeLivePictureInPictureController *)pictureInPicture;
37
-
38
- // {zh} 画中画将要开始 {en} PIP is about to start
39
- - (void)pictureInPictureWillStart:(VeLivePictureInPictureController *)pictureInPicture;
40
-
41
- // {zh} 画中画已经开始 {en} Picture-in-picture has begun
42
- - (void)pictureInPictureDidStart:(VeLivePictureInPictureController *)pictureInPicture;
43
-
44
- // {zh} 画中画启动失败 {en} Picture-in-picture startup failed
45
- - (void)pictureInPicture:(VeLivePictureInPictureController *)pictureInPicture
46
- failedToStartWithError:(NSError *)error;
47
-
48
- // {zh} 画中画将要结束 {en} Picture-in-picture is coming to an end
49
- - (void)pictureInPictureWillStop:(VeLivePictureInPictureController *)pictureInPicture isUserStop:(BOOL)isUserStop;
50
-
51
- // {zh} 画中画已经结束 {en} Picture-in-picture is over
52
- - (void)pictureInPictureDidStop:(VeLivePictureInPictureController *)pictureInPicture isUserStop:(BOOL)isUserStop;
53
-
54
- // {zh} 画中画将要结束,需要重新布局原来的画面 {en} The picture-in-picture is about to end, and the original picture needs to be rearranged.
55
- // {zh} 如果没有实现当前代理,内部会自动布局,contentView 和其父视图大小完全一致 {en} If the current proxy is not implemented, the interior is automatically laid out, and the contentView is exactly the same size as its parent view
56
- - (void)pictureInPicture:(VeLivePictureInPictureController *)pictureInPicture
57
- restoreUserInterfaceWithCompletionHandler:(void (^)(BOOL restored))completionHandler
58
- isUserStop:(BOOL)isUserStop;
59
- @end
60
-
61
- typedef NS_ENUM(NSInteger, VeLivePictureInPictureErrorCode) {
62
- VeLivePictureInPictureErrorCodeAlreadyStarted = 0,
63
- VeLivePictureInPictureErrorCodeFailed = -1001,
64
- VeLivePictureInPictureErrorCodePlayTemplateFileFailed = -1002,
65
- VeLivePictureInPictureErrorCodeTemplateFileNotFound = -1003,
66
- VeLivePictureInPictureErrorCodeNotPossible = -1004,
67
- };
68
-
69
- typedef NS_ENUM(NSInteger, VeLivePictureInPictureState) {
70
- VeLivePictureInPictureStateIde = 0,
71
- VeLivePictureInPictureStatePreparing = 1,
72
- VeLivePictureInPictureStateReady = 2,
73
- VeLivePictureInPictureStateRunning = 3,
74
- VeLivePictureInPictureStateStopping = 4,
75
- VeLivePictureInPictureStateError = 5,
76
- };
77
-
78
- typedef NS_ENUM(NSInteger, VeLivePictureInPictureType) {
79
- #if VEL_PICTURE_IN_PICTURE_ENABLE_PIP_BELOW_IOS_15
80
- VeLivePictureInPictureTypeAVPlayer = 0,
81
- VeLivePictureInPictureTypeAVPlayerViewController = 1,
82
- VeLivePictureInPictureTypeContentSourceAVPlayer API_AVAILABLE(ios(15.0)) = 2,
83
- #endif
84
- VeLivePictureInPictureTypeContentSource API_AVAILABLE(ios(15.0)) = 3,
85
- VeLivePictureInPictureTypeContentViewPlayerLayer = 4,
86
- // {zh} 自动根据系统选择 {en} Automatically select according to the system
87
- VeLivePictureInPictureTypeAuto = NSIntegerMax
88
- };
89
-
90
- @class VeLivePictureInPictureController;
91
- // {zh} 画中画准备完成回调 {en} PIP ready to complete callback
92
- typedef void (^VELPipPrepareCompletionBlock)(VeLivePictureInPictureController *_Nullable pipController, NSError *_Nullable error);
93
-
94
- // {zh} 基类,主要处理不同场景下的相同业务逻辑 {en} Base class, which mainly handles the same business logic in different scenarios
95
- @interface VeLivePictureInPictureController : NSObject
96
-
97
- // {zh} 需要小窗的视图 {en} View that requires small windows
98
- @property (nonatomic, weak, nullable) UIView *contentView;
99
-
100
- // {zh} contentView 所在的容器 {en} Container where contentView is located
101
- @property (nonatomic, weak, nullable) UIViewController *contentController;
102
-
103
- // {zh} 如果配置了 contentController 并且这个值设置为 YES。 {en} If contentController is configured and this value is set to YES.
104
- // {zh} 会在画中画启动的时候,把控制器隐藏。画中画结束后,自动展示该控制器 {en} Will hide the controller when the picture-in-picture starts. After the picture-in-picture is over, the controller is automatically displayed
105
- // {zh} 自动隐藏 contentController 默认 NO {en} Auto hide contentController default NO
106
- @property (nonatomic, assign) BOOL autoHideContentController;
107
-
108
- // {zh} 视频在 contentView 中的尺寸布局,用来存放画中画占位视图,如果不设置,内部自动计算 {en} The size layout of the video in contentView is used to store the picture-in-picture placeholder view. If it is not set, it will be automatically calculated internally.
109
- // {zh} 主要用于视频在非填充模式下,会有黑边,再设置占位视图的时候,尺寸大小不正确会有 UI 突变的问题 {en} Mainly used for video in non-filling mode, there will be black edges. When setting the placeholder view, if the size is incorrect, there will be a problem of UI mutation.
110
- // {zh} 默认取 contentView.frame {en} Default take contentView.frame
111
- @property (nonatomic, assign) CGRect videoFrame;
112
-
113
- // {zh} 当视频填充模式非等比例填充时,实际的 videoSize 应该比 videoFrame.size 大或者小,此处可更新视频宽高 {en} When the video filling mode is not proportionally filled, the actual videoSize should be larger or smaller than videoFrame.size. The video width and height can be updated here.
114
- @property (nonatomic, assign) CGSize videoSize;
115
-
116
- // {zh} 画中画占位视图,可以在画中画启动后,自行重新布局,内部初始会使用 contentView 的尺寸 {en} The picture-in-picture placeholder view can be rearranged by itself after the picture-in-picture is started, and the size of the contentView will be used initially inside.
117
- // {zh} type == ContentViewPlayerLayer 时为空 {en} type == ContentViewPlayerLayer be nil
118
- @property (nonatomic, strong, readonly, nullable) UIView *pipHolderView;
119
-
120
- // {zh} 如果送入多个 pixelBuffer 并且指定 videoRect,设置展示画中画的 fps,默认 15, 只在开启画中画前设置有效{en} If multiple pixelBuffers are sent and videoRect is specified, set the fps for displaying picture-in-picture, the default is 15. The setting is only valid before turning on picture-in-picture.
121
- @property (nonatomic, assign) int fps;
122
-
123
- // {zh} 如果输入多个视频源的话,需要指定正确的视频源数量,默认 1,只在开启画中画前设置有效 {en} If you input multiple video sources, you need to specify the correct number of video sources. The default is 1. The setting is only valid before turning on picture-in-picture.
124
- @property (nonatomic, assign) int videoSourceCount;
125
-
126
- // {zh} 代理回调 {en} proxy callback
127
- @property (nonatomic, weak) id <VeLivePictureInPictureDelegate> delegate;
128
-
129
- // {zh} 画中画填充模式 {en} PIP Fill Mode
130
- // {zh} 默认: AVLayerVideoGravityResize {en} Default: AVLayerVideoGravityResize
131
- @property (nonatomic, copy) AVLayerVideoGravity videoGravity;
132
-
133
- // {zh} 进入后台时,自动弹出小窗, 默认 YES {en} When entering the background, a small window will automatically pop up, and the default is YES.
134
- // {zh} 如果配置了 YES,画中画配置完成后,会在后台持续循环播放黑帧视频,App 进入后台后,会自动弹出小窗 {en} If YES is configured, after the picture-in-picture configuration is completed, the black frame video will continue to be played in a loop in the background. After the App enters the background, a small window will automatically pop up.
135
- @property (nonatomic, assign) BOOL canStartPictureInPictureAutomaticallyFromInline API_AVAILABLE(ios(14.2));
136
-
137
- // {zh} 是否可以调用 start 方法开启画中画 {en} Is it possible to call the start method to turn on picture-in-picture?
138
- @property (nonatomic, assign, readonly) BOOL canStartPictureInPicture;
139
-
140
- // {zh} 在手动启动画中画失败后,自动降级重试, 默认 NO {en} After the manual start of picture-in-picture fails, it will automatically downgrade and retry, the default is NO.
141
- // {zh} 如果开启,iOS 15 及以上系统的降级顺序是 ContentSource -> AVPlayerViewController -> AVPlayer {en} If enabled, the downgrade order for iOS 15 and above is ContentSource - > AVPlayerViewController - > AVPlayer
142
- // {zh} 如果开启,iOS 15 及以上系统的降级顺序是 AVPlayerViewController -> AVPlayer {en} If enabled, the downgrade order for iOS 15 and above is AVPlayerViewController - > AVPlayer
143
- @property (nonatomic, assign, readonly) BOOL downgradeWhenStartFailed;
144
-
145
- // {zh} 是否支持画中画 {en} Whether to support picture-in-picture
146
- @property (nonatomic, assign, readonly) BOOL isPictureInPictureSupported;
147
-
148
- // {zh} 当前是否已经有画中画在播放 {en} Is there already a picture-in-picture playing?
149
- @property (nonatomic, assign, readonly) BOOL isPictureInPictureStarted;
150
-
151
- // {zh} 画中画状态 {en} PIP state
152
- @property (atomic, assign, readonly) VeLivePictureInPictureState state;
153
-
154
- // {zh} 画中画类型 {en} PIP type
155
- @property (atomic, assign, readonly) VeLivePictureInPictureType type;
156
-
157
- // {zh} 初始化画中画控制器 {en} Preliminary picture-in-picture controller
158
- - (instancetype)initWithType:(VeLivePictureInPictureType)type NS_DESIGNATED_INITIALIZER;
159
-
160
- // {zh} 初始化画中画控制器 {en} Preliminary picture-in-picture controller
161
- - (instancetype)initWithContentView:(UIView *)contentView NS_DESIGNATED_INITIALIZER;
162
-
163
- // {zh} 初始化画中画控制器 {en} Preliminary picture-in-picture controller
164
- - (instancetype)initWithType:(VeLivePictureInPictureType)type contentView:(nullable UIView *)contentView NS_DESIGNATED_INITIALIZER;
165
-
166
- // {zh} 准备 {en} prepare
167
- - (void)prepareWithCompletion:(nullable VELPipPrepareCompletionBlock)completion;
168
-
169
- // {zh} 主动开启画中画 {en} Actively turn on picture-in-picture
170
- // {zh} 注意:只有 App 有声音播放时,才能正常启动画中画 {en} Note: Picture-in-picture can only be started normally when the App has sound playback.
171
- - (void)startPictureInPicture;
172
-
173
- // {zh} 停止当前正在展示的画中画,当进入后台,还会自动打开画中画 {en} Stop the picture-in-picture currently being displayed. When entering the background, it will also automatically open the picture-in-picture.
174
- - (void)stopPictureInPicture;
175
-
176
- // {zh} 销毁当前画中画,不会再推入后台后自动开启画中画 {en} Destroy the current picture-in-picture, it will not be automatically turned on after being pushed into the background.
177
- - (void)destroyPictureInPicture;
178
-
179
- // {zh} iOS 15 && type == VeLivePictureInPictureTypeContentSource 时使用 {en} iOS 15 & & type == VeLivePictureInPictureTypeContentSource
180
- // {zh} 只支持 BGRA 类型 {en} Only supports BGRA type
181
- - (void)enqueuePixelBuffer:(CVPixelBufferRef)pixelBuffer;
182
- - (void)enqueuePixelBuffer:(CVPixelBufferRef)pixelBuffer videoRect:(CGRect)videoRect;
183
-
184
- // {zh} iOS 15 && type == VeLivePictureInPictureTypeContentSource 时使用 {en} iOS 15 & & type == VeLivePictureInPictureTypeContentSource
185
- // {zh} 只支持 BGRA 类型 {en} Only supports BGRA type
186
- - (void)enqueueSampleBuffer:(CMSampleBufferRef)sampleBuffer;
187
- - (void)enqueueSampleBuffer:(CMSampleBufferRef)sampleBuffer videoRect:(CGRect)videoRect;
188
-
189
-
190
- // {zh} 销毁画中画所有实例,调用此方法后,不会在后台的时候自动弹出画中画,可以释放一部分内存 {en} Destroy all instances of PIP. After calling this method, PIP will not automatically pop up in the background, and part of the memory can be freed
191
- + (void)destroyPictureInPicture;
192
-
193
- // {zh} 是否支持画中画 {en} Whether to support picture-in-picture
194
- + (BOOL)isPictureInPictureSupported;
195
-
196
- // {zh} 当前是否已经有画中画在播放 {en} Is there already a picture-in-picture playing?
197
- + (BOOL)isPictureInPictureStarted;
198
- @end
199
-
200
-
201
-
202
-
203
- FOUNDATION_EXTERN NSString *VeLivePictureInPictureErrorDomain;
204
- FOUNDATION_EXPORT CGRect VELPixtureInPictureFullVideoRect;
205
- NS_ASSUME_NONNULL_END
206
-
207
-