Skip to content

Commit

Permalink
feat: support pip (#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe authored Sep 18, 2024
1 parent d022706 commit 9de6f4e
Show file tree
Hide file tree
Showing 35 changed files with 2,246 additions and 891 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@


## [4.3.2-build.5-rc.1](https://github.com/AgoraIO-Extensions/react-native-agora/compare/v4.3.2...v4.3.2-build.5-rc.1) (2024-09-18)


### Features

* **android:** pip ([13258cb](https://github.com/AgoraIO-Extensions/react-native-agora/commit/13258cb71c35c9a9b0337a1da84bc713f0d2da3c))
* **iOS:** pip ([96348ce](https://github.com/AgoraIO-Extensions/react-native-agora/commit/96348ce96f62566d81d7262f4e054f99330e3099))

## [4.3.2](https://github.com/AgoraIO-Extensions/react-native-agora/compare/v4.3.1...v4.3.2) (2024-06-06)


Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
api 'io.agora.rtc:full-sdk:4.3.2'
implementation 'io.agora.rtc:full-screen-sharing:4.3.2'
implementation 'io.agora.rtc:iris-rtc:4.3.2-build.1'
api 'io.agora.rtc:agora-special-full:4.3.2.6'
implementation 'io.agora.rtc:full-screen-sharing:4.3.2.6'
implementation 'io.agora.rtc:iris-rtc:4.3.2.5-build.4'
}

if (isNewArchitectureEnabled()) {
Expand Down
21 changes: 19 additions & 2 deletions android/src/main/java/io/agora/rtc/ng/react/AgoraRtcNgModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
public class AgoraRtcNgModule extends AgoraRtcNgSpec implements IrisEventHandler {
public static final String NAME = "AgoraRtcNg";
public IrisApiEngine irisApiEngine;
private long currentActivityAddress;

AgoraRtcNgModule(ReactApplicationContext context) {
super(context);
Expand All @@ -45,6 +46,7 @@ public boolean newIrisApiEngine() {
IrisApiEngine.enableUseJsonArray(true);
irisApiEngine = new IrisApiEngine(getReactApplicationContext());
irisApiEngine.setEventHandler(this);
currentActivityAddress = IrisApiEngine.GetJObjectAddress(getReactApplicationContext().getCurrentActivity());
return true;
}
return false;
Expand All @@ -54,6 +56,7 @@ public boolean newIrisApiEngine() {
public boolean destroyIrisApiEngine() {
if (irisApiEngine != null) {
irisApiEngine.setEventHandler(null);
IrisApiEngine.FreeJObjectByAddress(currentActivityAddress);
irisApiEngine.destroy();
irisApiEngine = null;
return true;
Expand All @@ -76,6 +79,9 @@ public String callApi(ReadableMap args) {
}

try {
if ("RtcEngine_setupPip_b0b4d39".equals(funcName)) {
params = handleSetupPip(params);
}
newIrisApiEngine();
return irisApiEngine.callIrisApi(funcName, params, buffers);
} catch (Exception e) {
Expand Down Expand Up @@ -117,7 +123,18 @@ public void OnEvent(String event, String data, List<byte[]> buffers) {
map.putArray("buffers", array);
}
getReactApplicationContext()
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit("AgoraRtcNg:onEvent", map);
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit("AgoraRtcNg:onEvent", map);
}

private String handleSetupPip(String params) {
try {
JSONObject paramsJson = new JSONObject(params);
JSONObject optionsJson = paramsJson.getJSONObject("options");
optionsJson.put("contentSource", currentActivityAddress);
return paramsJson.toString();
} catch (JSONException e) {
throw new RuntimeException(e);
}
}
}
1 change: 1 addition & 0 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:supportsPictureInPicture="true"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
Expand Down
8 changes: 8 additions & 0 deletions example/ios/AgoraRtcNgExample.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.avfoundation.multitasking-camera-access</key>
<true/>
</dict>
</plist>
4 changes: 4 additions & 0 deletions example/ios/AgoraRtcNgExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
51C0ADB2D05FD3E09BD14D10 /* libPods-ScreenShare.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4995956B4E8573A01AC9C535 /* libPods-ScreenShare.a */; };
7699B88040F8A987B510C191 /* libPods-AgoraRtcNgExample-AgoraRtcNgExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-AgoraRtcNgExample-AgoraRtcNgExampleTests.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
BB877BF02C4E33440009E4A0 /* AgoraRtcNgExample.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = BB877BEF2C4E33440009E4A0 /* AgoraRtcNgExample.entitlements */; };
F5652807291BE31F00793068 /* agora-logo.png in Resources */ = {isa = PBXBuildFile; fileRef = F56527FF291BE31E00793068 /* agora-logo.png */; };
F5652809291BE31F00793068 /* ding.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = F5652801291BE31E00793068 /* ding.mp3 */; };
F565280A291BE31F00793068 /* dang.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = F5652802291BE31E00793068 /* dang.mp3 */; };
Expand Down Expand Up @@ -75,6 +76,7 @@
6B4351393DA57450FBFEC119 /* Pods-ScreenShare.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ScreenShare.release.xcconfig"; path = "Target Support Files/Pods-ScreenShare/Pods-ScreenShare.release.xcconfig"; sourceTree = "<group>"; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = AgoraRtcNgExample/LaunchScreen.storyboard; sourceTree = "<group>"; };
89C6BE57DB24E9ADA2F236DE /* Pods-AgoraRtcNgExample-AgoraRtcNgExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AgoraRtcNgExample-AgoraRtcNgExampleTests.release.xcconfig"; path = "Target Support Files/Pods-AgoraRtcNgExample-AgoraRtcNgExampleTests/Pods-AgoraRtcNgExample-AgoraRtcNgExampleTests.release.xcconfig"; sourceTree = "<group>"; };
BB877BEF2C4E33440009E4A0 /* AgoraRtcNgExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = AgoraRtcNgExample.entitlements; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
F56527FF291BE31E00793068 /* agora-logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "agora-logo.png"; sourceTree = "<group>"; };
F5652801291BE31E00793068 /* ding.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = ding.mp3; sourceTree = "<group>"; };
Expand Down Expand Up @@ -170,6 +172,7 @@
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
BB877BEF2C4E33440009E4A0 /* AgoraRtcNgExample.entitlements */,
F56527FE291BE31E00793068 /* Resources */,
13B07FAE1A68108700A75B9A /* AgoraRtcNgExample */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
Expand Down Expand Up @@ -347,6 +350,7 @@
buildActionMask = 2147483647;
files = (
F5652809291BE31F00793068 /* ding.mp3 in Resources */,
BB877BF02C4E33440009E4A0 /* AgoraRtcNgExample.entitlements in Resources */,
F57F54D62A03AEA8008DFB3C /* effect.mp3 in Resources */,
F565280A291BE31F00793068 /* dang.mp3 in Resources */,
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ target 'AgoraRtcNgExample' do
end

target 'ScreenShare' do
pod 'AgoraRtcEngine_iOS', '4.3.2'
pod 'AgoraRtcEngine_Special_iOS', '4.3.2.5'
end
Loading

0 comments on commit 9de6f4e

Please sign in to comment.