@byteplus/react-native-live-pull 1.1.3-rc.4 → 1.2.0-rc.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 +2 -2
- package/android/src/main/java/com/volcengine/velive/rn/pull/ClassHelper.java +15 -0
- package/android/src/main/java/com/volcengine/velive/rn/pull/NativeVariableManager.java +1 -1
- package/android/src/main/java/com/volcengine/velive/rn/pull/VolcLiveModule.java +2 -0
- package/android/src/main/java/com/volcengine/velive/rn/pull/autogen/MethodSignature.java +66 -77
- package/android/src/main/java/com/volcengine/velive/rn/pull/pictureInpicture/FloatingWindowService.java +79 -15
- package/ios/VeLivePlayerMultiObserver.h +3 -2
- package/ios/VeLivePlayerMultiObserver.m +2 -2
- package/ios/include/react-native-velive-pull.modulemap +4 -0
- package/ios/pictureInpicture/PictureInPictureManager.h +21 -1
- package/ios/pictureInpicture/PictureInPictureManager.m +260 -141
- package/lib/commonjs/index.js +4455 -1648
- package/lib/module/index.js +4455 -1648
- package/lib/typescript/codegen/android/api.d.ts +51 -43
- package/lib/typescript/codegen/android/callback.d.ts +166 -0
- package/lib/typescript/codegen/android/errorcode.d.ts +123 -2
- package/lib/typescript/codegen/android/keytype.d.ts +501 -13
- package/lib/typescript/codegen/ios/api.d.ts +232 -16
- package/lib/typescript/codegen/ios/callback.d.ts +137 -1
- package/lib/typescript/codegen/ios/errorcode.d.ts +104 -0
- package/lib/typescript/codegen/ios/keytype.d.ts +460 -6
- package/lib/typescript/codegen/pack/api.d.ts +66 -57
- package/lib/typescript/codegen/pack/callback.d.ts +45 -21
- package/lib/typescript/codegen/pack/errorcode.d.ts +45 -15
- package/lib/typescript/codegen/pack/keytype.d.ts +388 -114
- package/lib/typescript/core/api.d.ts +13 -0
- package/lib/typescript/core/keytype.d.ts +18 -2
- package/package.json +1 -1
- package/react-native-velive-pull.podspec +12 -3
- package/ios/pictureInpicture/VeLivePictureInPictureController.h +0 -207
- package/ios/pictureInpicture/VeLivePictureInPictureController.m +0 -3393
package/android/build.gradle
CHANGED
|
@@ -88,6 +88,6 @@ dependencies {
|
|
|
88
88
|
// noinspection GradleDynamicVersion
|
|
89
89
|
implementation "com.facebook.react:react-native:+"
|
|
90
90
|
|
|
91
|
-
implementation "com.volcengine:VolcApiEngine:1.2
|
|
92
|
-
implementation 'com.bytedanceapi:ttsdk-ttlivepull_rtc:1.
|
|
91
|
+
implementation "com.volcengine:VolcApiEngine:1.6.2"
|
|
92
|
+
implementation 'com.bytedanceapi:ttsdk-ttlivepull_rtc:1.46.300.2'
|
|
93
93
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
package com.volcengine.velive.rn.pull;
|
|
2
|
+
|
|
3
|
+
import com.ss.videoarch.liveplayer.VeLivePlayer;
|
|
4
|
+
import com.ss.videoarch.liveplayer.VeLivePlayerDef;
|
|
5
|
+
import com.ss.videoarch.liveplayer.VeLivePlayerError;
|
|
6
|
+
import com.ss.videoarch.liveplayer.VeLivePlayerStatistics;
|
|
7
|
+
import com.volcengine.VolcApiEngine.runtime.Util;
|
|
8
|
+
|
|
9
|
+
public class ClassHelper {
|
|
10
|
+
public static void init() {
|
|
11
|
+
Util.JsonAbleClass.add(VeLivePlayerStatistics.class);
|
|
12
|
+
Util.JsonAbleClass.add(VeLivePlayerError.class);
|
|
13
|
+
Util.JsonAbleClass.add(VeLivePlayerDef.VeLivePlayerResolution.class);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -8,7 +8,7 @@ import com.volcengine.VolcApiEngine.runtime.*;
|
|
|
8
8
|
public class NativeVariableManager {
|
|
9
9
|
static void init(@NonNull MessageClient msgClient, ReactApplicationContext reactContext) {
|
|
10
10
|
var m = msgClient.proto.variableManager;
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
m.registerVar("ApplicationContext", (Object[] args) -> reactContext.getApplicationContext());
|
|
13
13
|
m.registerVar("ReactApplicationContext", (Object[] args) -> reactContext);
|
|
14
14
|
}
|
|
@@ -10,6 +10,7 @@ import com.facebook.react.bridge.ReadableMap;
|
|
|
10
10
|
import com.facebook.react.bridge.WritableMap;
|
|
11
11
|
import com.facebook.react.module.annotations.ReactModule;
|
|
12
12
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
13
|
+
import com.ss.videoarch.liveplayer.VeLivePlayerDef;
|
|
13
14
|
import com.volcengine.VolcApiEngine.*;
|
|
14
15
|
import com.volcengine.velive.rn.pull.autogen.MethodSignature;
|
|
15
16
|
|
|
@@ -23,6 +24,7 @@ public class VolcLiveModule
|
|
|
23
24
|
VolcLiveModule(ReactApplicationContext context) {
|
|
24
25
|
super(context);
|
|
25
26
|
MethodSignature.init();
|
|
27
|
+
ClassHelper.init();
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
@Override
|
|
@@ -4,123 +4,112 @@ import static com.volcengine.VolcApiEngine.runtime.MethodSignature.*;
|
|
|
4
4
|
|
|
5
5
|
import android.view.Surface;
|
|
6
6
|
import android.view.SurfaceHolder;
|
|
7
|
-
|
|
8
7
|
import com.ss.videoarch.liveplayer.VeLivePlayer;
|
|
9
8
|
import com.ss.videoarch.liveplayer.VeLivePlayerConfiguration;
|
|
10
9
|
import com.ss.videoarch.liveplayer.VeLivePlayerDef;
|
|
11
10
|
import com.ss.videoarch.liveplayer.VeLivePlayerObserver;
|
|
12
11
|
import com.ss.videoarch.liveplayer.VeLivePlayerStreamData;
|
|
13
12
|
import com.ss.videoarch.liveplayer.log.VeLivePlayerLogConfig;
|
|
14
|
-
|
|
15
13
|
import java.util.Map;
|
|
16
14
|
|
|
17
15
|
public class MethodSignature {
|
|
18
16
|
static public void init() {
|
|
19
17
|
try {
|
|
20
|
-
var r = createClassMethodRegister(
|
|
18
|
+
var r = createClassMethodRegister(
|
|
19
|
+
"com.ss.videoarch.liveplayer.VideoLiveManager");
|
|
21
20
|
|
|
22
|
-
r.put(
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
r.put("setConfig", VeLivePlayer.class.getMethod(
|
|
22
|
+
"setConfig", VeLivePlayerConfiguration.class));
|
|
23
|
+
|
|
24
|
+
r.put("setObserver", VeLivePlayer.class.getMethod(
|
|
25
|
+
"setObserver", VeLivePlayerObserver.class));
|
|
25
26
|
|
|
26
27
|
r.put(
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
"setRenderFillMode",
|
|
29
|
+
VeLivePlayer.class.getMethod(
|
|
30
|
+
"setRenderFillMode", VeLivePlayerDef.VeLivePlayerFillMode.class));
|
|
29
31
|
|
|
30
|
-
r.put("setRenderFillMode",
|
|
31
|
-
VeLivePlayer.class.getMethod("setRenderFillMode", VeLivePlayerDef.VeLivePlayerFillMode.class));
|
|
32
|
-
|
|
33
32
|
r.put("getVersion", VeLivePlayer.class.getMethod("getVersion"));
|
|
34
|
-
|
|
35
|
-
r.put(
|
|
36
|
-
"setSurfaceHolder",
|
|
37
|
-
VeLivePlayer.class.getMethod("setSurfaceHolder", SurfaceHolder.class));
|
|
38
|
-
|
|
39
|
-
r.put("setSurface",
|
|
40
|
-
VeLivePlayer.class.getMethod("setSurface", Surface.class));
|
|
41
33
|
|
|
42
|
-
r.put(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
r.put("setSurfaceHolder", VeLivePlayer.class.getMethod(
|
|
35
|
+
"setSurfaceHolder", SurfaceHolder.class));
|
|
36
|
+
|
|
37
|
+
r.put("setSurface",
|
|
38
|
+
VeLivePlayer.class.getMethod("setSurface", Surface.class));
|
|
39
|
+
|
|
40
|
+
r.put("setPlayUrl",
|
|
41
|
+
VeLivePlayer.class.getMethod("setPlayUrl", String.class));
|
|
49
42
|
|
|
50
43
|
r.put(
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
"setLogLevel",
|
|
45
|
+
VeLivePlayer.class.getMethod(
|
|
46
|
+
"setLogLevel", VeLivePlayerLogConfig.VeLivePlayerLogLevel.class));
|
|
47
|
+
|
|
48
|
+
r.put("setLogConfig", VeLivePlayer.class.getMethod(
|
|
49
|
+
"setLogConfig", VeLivePlayerLogConfig.class));
|
|
53
50
|
|
|
54
51
|
r.put("setPlayStreamData",
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
r.put(
|
|
58
|
-
"play",
|
|
59
|
-
VeLivePlayer.class.getMethod("play"));
|
|
60
|
-
r.put(
|
|
61
|
-
"pause",
|
|
62
|
-
VeLivePlayer.class.getMethod("pause"));
|
|
52
|
+
VeLivePlayer.class.getMethod("setPlayStreamData",
|
|
53
|
+
VeLivePlayerStreamData.class));
|
|
63
54
|
|
|
64
|
-
r.put(
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
r.put("play", VeLivePlayer.class.getMethod("play"));
|
|
56
|
+
r.put("pause", VeLivePlayer.class.getMethod("pause"));
|
|
57
|
+
|
|
58
|
+
r.put("stop", VeLivePlayer.class.getMethod("stop"));
|
|
67
59
|
|
|
68
60
|
r.put("destroy", VeLivePlayer.class.getMethod("destroy"));
|
|
69
61
|
|
|
70
|
-
r.put(
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
r.put("switchResolution",
|
|
63
|
+
VeLivePlayer.class.getMethod(
|
|
64
|
+
"switchResolution",
|
|
65
|
+
VeLivePlayerDef.VeLivePlayerResolution.class));
|
|
73
66
|
|
|
74
67
|
r.put("isPlaying", VeLivePlayer.class.getMethod("isPlaying"));
|
|
75
68
|
|
|
76
|
-
r.put(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
r.put("setPlayerVolume",
|
|
70
|
+
VeLivePlayer.class.getMethod("setPlayerVolume", float.class));
|
|
71
|
+
|
|
80
72
|
r.put("setMute", VeLivePlayer.class.getMethod("setMute", boolean.class));
|
|
81
73
|
|
|
82
74
|
r.put("isMute", VeLivePlayer.class.getMethod("isMute"));
|
|
83
|
-
|
|
84
|
-
r.put(
|
|
85
|
-
"setUrlHostIP",
|
|
86
|
-
VeLivePlayer.class.getMethod("setUrlHostIP", Map.class));
|
|
87
75
|
|
|
88
|
-
r.put(
|
|
89
|
-
|
|
90
|
-
VeLivePlayer.class.getMethod("setGlobalUrlHostIP", Map.class));
|
|
76
|
+
r.put("setUrlHostIP",
|
|
77
|
+
VeLivePlayer.class.getMethod("setUrlHostIP", Map.class));
|
|
91
78
|
|
|
92
|
-
r.put(
|
|
93
|
-
|
|
94
|
-
VeLivePlayer.class.getMethod("setProperty", String.class, Object.class));
|
|
79
|
+
r.put("setGlobalUrlHostIP",
|
|
80
|
+
VeLivePlayer.class.getMethod("setGlobalUrlHostIP", Map.class));
|
|
95
81
|
|
|
96
|
-
r.put(
|
|
97
|
-
|
|
98
|
-
VeLivePlayer.class.getMethod("snapshot"));
|
|
82
|
+
r.put("setProperty", VeLivePlayer.class.getMethod(
|
|
83
|
+
"setProperty", String.class, Object.class));
|
|
99
84
|
|
|
100
|
-
r.put(
|
|
101
|
-
"enableVideoFrameObserver",
|
|
102
|
-
VeLivePlayer.class.getMethod(
|
|
103
|
-
"enableVideoFrameObserver",
|
|
104
|
-
boolean.class, VeLivePlayerDef.VeLivePlayerPixelFormat.class, VeLivePlayerDef.VeLivePlayerVideoBufferType.class));
|
|
85
|
+
r.put("snapshot", VeLivePlayer.class.getMethod("snapshot"));
|
|
105
86
|
|
|
106
|
-
r.put(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
r.put(
|
|
113
|
-
|
|
114
|
-
|
|
87
|
+
r.put("enableVideoFrameObserver",
|
|
88
|
+
VeLivePlayer.class.getMethod(
|
|
89
|
+
"enableVideoFrameObserver", boolean.class,
|
|
90
|
+
VeLivePlayerDef.VeLivePlayerPixelFormat.class,
|
|
91
|
+
VeLivePlayerDef.VeLivePlayerVideoBufferType.class));
|
|
92
|
+
|
|
93
|
+
r.put("enableAudioFrameObserver",
|
|
94
|
+
VeLivePlayer.class.getMethod(
|
|
95
|
+
"enableAudioFrameObserver", boolean.class, boolean.class,
|
|
96
|
+
VeLivePlayerDef.VeLivePlayerAudioBufferType.class));
|
|
115
97
|
|
|
116
98
|
r.put(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
99
|
+
"setRenderRotation",
|
|
100
|
+
VeLivePlayer.class.getMethod(
|
|
101
|
+
"setRenderRotation", VeLivePlayerDef.VeLivePlayerRotation.class));
|
|
102
|
+
|
|
103
|
+
r.put("setRenderMirror",
|
|
104
|
+
VeLivePlayer.class.getMethod(
|
|
105
|
+
"setRenderMirror", VeLivePlayerDef.VeLivePlayerMirror.class));
|
|
120
106
|
|
|
121
|
-
r.put("setEnableSuperResolution",
|
|
107
|
+
r.put("setEnableSuperResolution",
|
|
108
|
+
VeLivePlayer.class.getMethod("setEnableSuperResolution",
|
|
109
|
+
boolean.class));
|
|
122
110
|
|
|
123
|
-
r.put("setEnableSharpen",
|
|
111
|
+
r.put("setEnableSharpen",
|
|
112
|
+
VeLivePlayer.class.getMethod("setEnableSharpen", boolean.class));
|
|
124
113
|
|
|
125
114
|
} catch (NoSuchMethodException e) {
|
|
126
115
|
throw new RuntimeException(e);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package com.volcengine.velive.rn.pull.pictureInpicture;
|
|
2
2
|
|
|
3
3
|
import android.animation.ValueAnimator;
|
|
4
|
+
import android.app.ActivityManager;
|
|
4
5
|
import android.app.Service;
|
|
5
6
|
import android.content.BroadcastReceiver;
|
|
6
7
|
import android.content.Context;
|
|
@@ -23,6 +24,7 @@ import android.view.ViewConfiguration;
|
|
|
23
24
|
import android.view.WindowManager;
|
|
24
25
|
import androidx.annotation.Nullable;
|
|
25
26
|
import com.volcengine.velive.rn.pull.R;
|
|
27
|
+
import java.util.List;
|
|
26
28
|
|
|
27
29
|
public class FloatingWindowService extends Service {
|
|
28
30
|
private static final int MARGIN_TOP = 40;
|
|
@@ -66,6 +68,7 @@ public class FloatingWindowService extends Service {
|
|
|
66
68
|
public void onDestroy() {
|
|
67
69
|
Log.d(TAG, "onDestroy");
|
|
68
70
|
super.onDestroy();
|
|
71
|
+
|
|
69
72
|
unregisterActivityLaunchReceiver(); // Ensure receiver is unregistered on
|
|
70
73
|
// destroy
|
|
71
74
|
if (mSmallWindowView != null) {
|
|
@@ -110,15 +113,15 @@ public class FloatingWindowService extends Service {
|
|
|
110
113
|
|
|
111
114
|
int maxLen;
|
|
112
115
|
if (isPortrait) {
|
|
113
|
-
//
|
|
116
|
+
// in portrait mode, width cannot exceed drawableWidth
|
|
114
117
|
maxLen = drawableWidth;
|
|
115
118
|
} else {
|
|
116
|
-
//
|
|
119
|
+
// in landscape mode, height cannot exceed drawableHeight
|
|
117
120
|
maxLen = drawableHeight;
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
int width, height;
|
|
121
|
-
if (aspectRatio >= 1) { //
|
|
124
|
+
if (aspectRatio >= 1) { // wider than tall (landscape or square video)
|
|
122
125
|
width = maxLen;
|
|
123
126
|
height = (int)(width / aspectRatio);
|
|
124
127
|
if (isPortrait && width > drawableWidth) {
|
|
@@ -178,28 +181,72 @@ public class FloatingWindowService extends Service {
|
|
|
178
181
|
Log.d(TAG, "PIP window clicked");
|
|
179
182
|
|
|
180
183
|
try {
|
|
181
|
-
|
|
184
|
+
if (isAppRunningInForeground()) {
|
|
185
|
+
unregisterActivityLaunchReceiver();
|
|
186
|
+
stopSelf();
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Get the main activity
|
|
182
191
|
String packageName = this.getPackageName();
|
|
183
192
|
Intent launchIntent =
|
|
184
|
-
this.getPackageManager().getLaunchIntentForPackage(
|
|
185
|
-
packageName);
|
|
186
|
-
|
|
193
|
+
this.getPackageManager().getLaunchIntentForPackage(packageName);
|
|
187
194
|
if (launchIntent != null) {
|
|
188
|
-
Log.d(TAG, "Launching app with intent: " + launchIntent);
|
|
189
195
|
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
190
196
|
// Register receiver to stop service when activity is launched
|
|
191
197
|
registerActivityLaunchReceiver();
|
|
192
198
|
this.startActivity(launchIntent);
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
199
|
+
|
|
200
|
+
// Wait for app to reach foreground before closing floating window
|
|
201
|
+
checkAppForegroundAndClose();
|
|
196
202
|
}
|
|
197
203
|
} catch (Exception e) {
|
|
198
|
-
|
|
204
|
+
|
|
199
205
|
}
|
|
200
|
-
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private boolean isAppRunningInForeground() {
|
|
212
|
+
ActivityManager activityManager =
|
|
213
|
+
(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
|
|
214
|
+
if (activityManager == null) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
String packageName = getPackageName();
|
|
219
|
+
|
|
220
|
+
// For Android API level 21 and above
|
|
221
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
222
|
+
List<ActivityManager.RunningAppProcessInfo> runningProcesses =
|
|
223
|
+
activityManager.getRunningAppProcesses();
|
|
224
|
+
if (runningProcesses != null) {
|
|
225
|
+
for (ActivityManager.RunningAppProcessInfo processInfo :
|
|
226
|
+
runningProcesses) {
|
|
227
|
+
if (processInfo.processName.equals(packageName)) {
|
|
228
|
+
// Check if the process is in foreground
|
|
229
|
+
if (processInfo.importance ==
|
|
230
|
+
ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
} else {
|
|
237
|
+
// For older Android versions, use deprecated method
|
|
238
|
+
@SuppressWarnings("deprecation")
|
|
239
|
+
List<ActivityManager.RunningTaskInfo> runningTasks =
|
|
240
|
+
activityManager.getRunningTasks(1);
|
|
241
|
+
if (runningTasks != null && !runningTasks.isEmpty()) {
|
|
242
|
+
ActivityManager.RunningTaskInfo topTask = runningTasks.get(0);
|
|
243
|
+
if (topTask.topActivity != null &&
|
|
244
|
+
packageName.equals(topTask.topActivity.getPackageName())) {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
201
247
|
}
|
|
202
248
|
}
|
|
249
|
+
return false;
|
|
203
250
|
}
|
|
204
251
|
|
|
205
252
|
private void registerActivityLaunchReceiver() {
|
|
@@ -228,6 +275,25 @@ public class FloatingWindowService extends Service {
|
|
|
228
275
|
}
|
|
229
276
|
}
|
|
230
277
|
|
|
278
|
+
private Handler mHandler = new Handler(Looper.getMainLooper());
|
|
279
|
+
|
|
280
|
+
private void checkAppForegroundAndClose() {
|
|
281
|
+
mHandler.postDelayed(new Runnable() {
|
|
282
|
+
private int checkCount = 0;
|
|
283
|
+
|
|
284
|
+
@Override
|
|
285
|
+
public void run() {
|
|
286
|
+
if (isAppRunningInForeground()) {
|
|
287
|
+
unregisterActivityLaunchReceiver();
|
|
288
|
+
stopSelf();
|
|
289
|
+
} else if (checkCount < 20) { // Check up to 20 times
|
|
290
|
+
checkCount++;
|
|
291
|
+
mHandler.postDelayed(this, 500);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}, 500);
|
|
295
|
+
}
|
|
296
|
+
|
|
231
297
|
// BroadcastReceiver to listen for activity launch confirmation
|
|
232
298
|
private class ActivityLaunchReceiver extends BroadcastReceiver {
|
|
233
299
|
@Override
|
|
@@ -373,8 +439,6 @@ public class FloatingWindowService extends Service {
|
|
|
373
439
|
mLayoutParams.x = mLayoutParams.x + movedX;
|
|
374
440
|
mLayoutParams.y = mLayoutParams.y + movedY;
|
|
375
441
|
|
|
376
|
-
// 使用预先获取的屏幕高度 screenHeight
|
|
377
|
-
// 限制y坐标在安全区域内
|
|
378
442
|
mLayoutParams.y = Math.max(
|
|
379
443
|
MARGIN_TOP, Math.min(mLayoutParams.y, this.screenHeight -
|
|
380
444
|
mLayoutParams.height -
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
|
-
#import
|
|
2
|
+
#import <TTSDKFramework/TVLManager.h>
|
|
3
3
|
|
|
4
4
|
NS_ASSUME_NONNULL_BEGIN
|
|
5
5
|
|
|
@@ -30,7 +30,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
30
30
|
* @param observerId 观察者ID,相同ID会覆盖之前的观察者
|
|
31
31
|
* @param observer 观察者对象
|
|
32
32
|
*/
|
|
33
|
-
- (void)addObserver:(NSString *)observerId
|
|
33
|
+
- (void)addObserver:(NSString *)observerId
|
|
34
|
+
observer:(id<VeLivePlayerObserver>)observer;
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* 从代理列表中移除观察者
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#import "VeLivePlayerMultiObserver.h"
|
|
2
|
-
#import
|
|
2
|
+
#import <TTSDKFramework/TVLManager.h>
|
|
3
3
|
|
|
4
4
|
@interface VeLivePlayerMultiObserver ()
|
|
5
5
|
@property(nonatomic, strong) NSMutableDictionary *observerDict;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
- (void)setupPlayer:(TVLManager *)player {
|
|
38
|
-
if(self.player) {
|
|
38
|
+
if (self.player) {
|
|
39
39
|
[self clearObservers];
|
|
40
40
|
}
|
|
41
41
|
self.player = player;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#import <AVKit/AVKit.h>
|
|
1
2
|
#import <Foundation/Foundation.h>
|
|
2
3
|
@class TVLManager;
|
|
3
4
|
@class UIView;
|
|
@@ -11,6 +12,16 @@
|
|
|
11
12
|
|
|
12
13
|
@interface VeLivePictureInPictureManager : NSObject
|
|
13
14
|
|
|
15
|
+
// Configure whether to support automatic picture-in-picture in background
|
|
16
|
+
// Default is NO
|
|
17
|
+
@property(nonatomic, assign)
|
|
18
|
+
BOOL canStartPictureInPictureAutomaticallyFromInline API_AVAILABLE(ios(14.2)
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
// Whether to automatically hide the current player's view controller after
|
|
22
|
+
// starting picture-in-picture, default is NO
|
|
23
|
+
@property(nonatomic, assign) BOOL autoHideViewController;
|
|
24
|
+
|
|
14
25
|
// Expose shared instance methods to RN
|
|
15
26
|
+ (instancetype)sharedInstance;
|
|
16
27
|
+ (instancetype)getInstance;
|
|
@@ -25,5 +36,14 @@
|
|
|
25
36
|
- (BOOL)isPictureInPictureSupported;
|
|
26
37
|
- (void)setListener:(id<VeLivePictureInPictureManagerListener>)listener;
|
|
27
38
|
|
|
39
|
+
// register a PIP controller observer, returns an observer ID
|
|
40
|
+
- (NSString *)addPipControllerObserver:
|
|
41
|
+
(void (^)(AVPictureInPictureController *pipController))observer;
|
|
42
|
+
|
|
43
|
+
// remove a PIP controller observer by its ID
|
|
44
|
+
- (void)removePipControllerObserver:(NSString *)observerId;
|
|
28
45
|
|
|
29
|
-
|
|
46
|
+
// This method is used to remove all observers registered for the PIP controller
|
|
47
|
+
- (void)removeAllPipControllerObservers;
|
|
48
|
+
|
|
49
|
+
@end
|