@byteplus/react-native-live-push 1.4.0 → 1.5.1-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 (36) hide show
  1. package/android/build.gradle +15 -3
  2. package/android/src/main/java/com/volcengine/velive/rn/push/EnvHelper.java +1 -1
  3. package/android/src/main/java/com/volcengine/velive/rn/push/VeLivePushImpl.java +73 -0
  4. package/android/src/main/java/com/volcengine/velive/rn/push/VeLivePushPackage.java +36 -11
  5. package/android/src/main/java/com/volcengine/velive/rn/push/VeLivePushView.java +1 -0
  6. package/android/src/main/java/com/volcengine/velive/rn/push/mixer/TextureMgr.java +1 -1
  7. package/android/src/newarch/com/volcengine/velive/rn/push/VeLivePushModule.java +92 -0
  8. package/android/src/{main/java → oldarch}/com/volcengine/velive/rn/push/VeLivePushModule.java +12 -48
  9. package/ios/RCTVeLivePush/RCTVeLivePush.h +22 -0
  10. package/ios/RCTVeLivePush/RCTVeLivePush.mm +141 -0
  11. package/ios/VeLivePushImpl.h +38 -0
  12. package/ios/VeLivePushImpl.m +51 -0
  13. package/lib/commonjs/index.js +462 -256
  14. package/lib/commonjs/typescript/index.d.ts +1 -0
  15. package/lib/commonjs/typescript/module.d.ts +4 -0
  16. package/lib/commonjs/typescript/platforms/TurboModule/NativeVeLivePush.d.ts +193 -0
  17. package/lib/commonjs/typescript/platforms/TurboModule/index.d.ts +1 -0
  18. package/lib/commonjs/typescript/utils/index.d.ts +1 -0
  19. package/lib/module/index.js +486 -282
  20. package/lib/module/typescript/index.d.ts +1 -0
  21. package/lib/module/typescript/module.d.ts +4 -0
  22. package/lib/module/typescript/platforms/TurboModule/NativeVeLivePush.d.ts +193 -0
  23. package/lib/module/typescript/platforms/TurboModule/index.d.ts +1 -0
  24. package/lib/module/typescript/utils/index.d.ts +1 -0
  25. package/lib/typescript/index.d.ts +1 -0
  26. package/lib/typescript/module.d.ts +4 -0
  27. package/lib/typescript/platforms/TurboModule/NativeVeLivePush.d.ts +193 -0
  28. package/lib/typescript/platforms/TurboModule/index.d.ts +1 -0
  29. package/lib/typescript/utils/index.d.ts +1 -0
  30. package/package.json +6 -5
  31. package/react-native-velive-push.podspec +9 -5
  32. package/src/platforms/TurboModule/NativeVeLivePush.ts +242 -0
  33. package/src/platforms/TurboModule/index.ts +1 -0
  34. package/ios/VeLivePushSDK.h +0 -24
  35. package/ios/VeLivePushSDK.m +0 -98
  36. /package/android/src/{main/java → oldarch}/com/volcengine/velive/rn/push/VeLivePushModuleSpec.java +0 -0
@@ -1,5 +1,6 @@
1
1
  export { setupLogger, LogLevel } from '@vcloud-lux/hybrid-runtime';
2
2
  export * from '@vcloud-lux/hybrid-runtime/react-native';
3
+ export * from './platforms/TurboModule';
3
4
  export * from './component';
4
5
  export * from './core';
5
6
  export * from './view';
@@ -0,0 +1,4 @@
1
+ declare const isTurboModuleEnabled: boolean;
2
+ declare const VeLivePush: any;
3
+ export default VeLivePush;
4
+ export { isTurboModuleEnabled };
@@ -0,0 +1,193 @@
1
+ import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
2
+ export declare enum CALL_TYPE {
3
+ /**
4
+ * 获取动态变量
5
+ */
6
+ VAR_GETTER = "var_get",
7
+ /**
8
+ * 调用静态方法
9
+ */
10
+ PLAIN_API_CALL = "plain_api_call",
11
+ /**
12
+ * 实例化对象
13
+ */
14
+ NEW_INSTANCE = "new_instance",
15
+ /**
16
+ * 调用 api 上的方法
17
+ */
18
+ INSTANCE_METHOD_INVOKE = "instance_method_invoke",
19
+ /**
20
+ * 设置属性
21
+ */
22
+ INSTANCE_MEMBER_SET = "instance_member_set",
23
+ /**
24
+ * 设置属性
25
+ */
26
+ INSTANCE_MEMBER_GET = "instance_member_get",
27
+ /**
28
+ * 注册回调函数
29
+ */
30
+ INSTANCE_EVENT_LISTENER_ADD = "instance_event_add",
31
+ /**
32
+ * 移除回调函数
33
+ */
34
+ INSTANCE_EVENT_LISTENER_REMOVE = "instance_event_remove",
35
+ /**
36
+ * 触发事件
37
+ */
38
+ INSTANCE_EVENT_EMIT = "instance_event_emit",
39
+ /**
40
+ * 事件执行后的返回值
41
+ */
42
+ INSTANCE_EVENT_RESULT = "instance_event_result",
43
+ /**
44
+ * 销毁实例
45
+ */
46
+ DESTROY_INSTANCE = "destroy_instance",
47
+ /**
48
+ * 触发事件
49
+ */
50
+ CALLBACK_EMIT = "callback_emit"
51
+ }
52
+ declare const enum ARG_TYPE {
53
+ /**
54
+ * 类的实例
55
+ */
56
+ INSTANCE = "instance",
57
+ /**
58
+ * callback 函数
59
+ */
60
+ CALLBACK = "callback",
61
+ /**
62
+ * 枚举
63
+ */
64
+ ENUM = "enum",
65
+ /**
66
+ * 运行时变量
67
+ * 比如:android 的 ApplicationContext
68
+ */
69
+ VARIABLE = "variable",
70
+ /**
71
+ * 二进制数据
72
+ */
73
+ BASE64 = "base64",
74
+ /**
75
+ *
76
+ */
77
+ IMAGE_RESOURCE = "image_resource"
78
+ }
79
+ /**
80
+ * 对象实例,随机分配 id
81
+ */
82
+ interface IInstance {
83
+ _type: ARG_TYPE.INSTANCE;
84
+ _instanceId: string;
85
+ _serviceName?: string;
86
+ }
87
+ /**
88
+ * 回调函数,随机分配 id
89
+ */
90
+ interface ICallback {
91
+ _type: ARG_TYPE.CALLBACK;
92
+ _callbackId: string;
93
+ }
94
+ /**
95
+ * 对象实例,随机分配 id
96
+ */
97
+ interface IEnum {
98
+ _type: ARG_TYPE.ENUM;
99
+ _enumName?: string;
100
+ _name?: string;
101
+ _value?: string | number;
102
+ }
103
+ /**
104
+ * 回调函数,随机分配 id
105
+ */
106
+ interface IBinaryBase64 {
107
+ _type: ARG_TYPE.BASE64;
108
+ _value: string;
109
+ }
110
+ /**
111
+ * json 支持的数据类型
112
+ * 包括:object, array, string, number, null
113
+ */
114
+ export type IJsonDataType = object | Array<IJsonDataType> | string | number | null;
115
+ export type IMixinData = IInstance | ICallback | IEnum | IBinaryBase64 | IJsonDataType;
116
+ export interface ICallParams {
117
+ /**
118
+ * 调用类型
119
+ */
120
+ callType: CALL_TYPE;
121
+ /**
122
+ * 实例对象 id,调用实例上的方法、设置实例上属性时需要
123
+ */
124
+ _instanceId?: string;
125
+ /**
126
+ * 实例类型,GC 时需要
127
+ */
128
+ _instanceType?: INSTANCE_TYPE;
129
+ /**
130
+ * 方法名称或者属性名称,需要传入完整路径
131
+ * @example com.xx.class.doSome
132
+ */
133
+ serviceName: string;
134
+ /**
135
+ * 方法名称
136
+ */
137
+ methodName?: string;
138
+ /**
139
+ * 属性名称
140
+ */
141
+ memberName?: string;
142
+ /**
143
+ * api 的入参,解析后传给对应的 api
144
+ */
145
+ args?: Array<IMixinData>;
146
+ /**
147
+ * 是否需要等待结果返回
148
+ * for: 部分 android/ios 回调需要同步执行
149
+ */
150
+ waitResult?: boolean;
151
+ _traceId?: string;
152
+ /** 是否在主线程执行 */
153
+ runOnMainThread?: boolean;
154
+ }
155
+ export declare enum INSTANCE_TYPE {
156
+ /**
157
+ * 自动 GC 类型
158
+ */
159
+ AUTOMATIC = 0,
160
+ /**
161
+ * 手动 GC 类型
162
+ */
163
+ MANUAL = 1
164
+ }
165
+ /**
166
+ * NativeBridgeModule规范接口
167
+ * TODO 适配方案:
168
+ * 1. 生成在nodemodules内部,路径要稳定,单独chunk,建议不要被打包,直接作为JS或者Native代码调用
169
+ * 2. 代码生成方式, 生成一个Spec
170
+ */
171
+ export interface Spec extends TurboModule {
172
+ /**
173
+ * 异步调用原生方法
174
+ * @param params 调用参数
175
+ * @returns 调用结果
176
+ */
177
+ callSync(params: string): string;
178
+ /**
179
+ * 同步调用原生方法
180
+ * @param params 调用参数
181
+ * @param callback 结果回调函数
182
+ */
183
+ call(params: string, callback: (res: string) => void): void;
184
+ newApiEngine(): boolean;
185
+ destroyApiEngine(): boolean;
186
+ addListener: (eventType: string) => void;
187
+ removeListeners: (count: number) => void;
188
+ }
189
+ /**
190
+ * 获取NativeBridgeModule实例
191
+ */
192
+ declare const _default: Spec | null;
193
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default as VeLivePush, CALL_TYPE } from './NativeVeLivePush';
@@ -2,3 +2,4 @@ import { IPackClassInterface } from '@vcloud-lux/hybrid-runtime';
2
2
  import * as $p_a from '../codegen/android';
3
3
  import * as $p_i from '../codegen/ios';
4
4
  export declare function runImpl<T = any>(context: IPackClassInterface, androidImpl: (engine: $p_a.VeLivePusher) => T, iosImpl: (engine: $p_i.VeLivePusher) => T): T;
5
+ export declare function isNewArch(): boolean;