Skip to content

Commit 35ce2b0

Browse files
author
xianing
committed
Add example for two process screen sharing
1 parent 6226b85 commit 35ce2b0

32 files changed

Lines changed: 3020 additions & 4 deletions

Android/APIExample/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,5 @@ dependencies {
5757
implementation project(path: ':lib-push-externalvideo')
5858
implementation project(path: ':lib-raw-data')
5959
implementation project(path: ':lib-switch-external-video')
60+
implementation project(path: ':lib-screensharing')
6061
}

Android/APIExample/app/src/main/java/io/agora/api/example/ExampleActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import io.agora.api.example.examples.advanced.SetVideoProfile;
2727
import io.agora.api.example.examples.advanced.SwitchExternalVideo;
2828
import io.agora.api.example.examples.advanced.SetAudioProfile;
29+
import io.agora.api.example.examples.advanced.TwoProcess;
2930
import io.agora.api.example.examples.advanced.VideoQuickSwitch;
3031
import io.agora.api.example.examples.advanced.RTMPInjection;
3132
import io.agora.api.example.examples.advanced.RTMPStreaming;
@@ -134,6 +135,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
134135
case R.id.action_mainFragment_to_channel_encryption:
135136
fragment = new ChannelEncryption();
136137
break;
138+
case R.id.action_mainFragment_to_two_process_screen_share:
139+
fragment = new TwoProcess();
140+
break;
137141
default:
138142
fragment = new JoinChannelAudio();
139143
break;

Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/TwoProcess.java

Lines changed: 495 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:fitsSystemWindows="true"
7+
tools:context=".examples.advanced.TwoProcess">
8+
9+
<FrameLayout
10+
android:id="@+id/fl_local"
11+
android:layout_width="match_parent"
12+
android:layout_height="match_parent"
13+
android:layout_above="@+id/ll_join" />
14+
15+
<FrameLayout
16+
android:id="@+id/fl_remote"
17+
android:layout_width="150dp"
18+
android:layout_height="200dp"
19+
android:layout_alignParentTop="true"
20+
android:layout_alignParentEnd="true" />
21+
22+
<LinearLayout
23+
android:id="@+id/ll_join"
24+
android:layout_width="match_parent"
25+
android:layout_height="wrap_content"
26+
android:layout_alignParentBottom="true"
27+
android:gravity="center_vertical"
28+
android:orientation="horizontal">
29+
30+
<androidx.appcompat.widget.AppCompatEditText
31+
android:id="@+id/et_channel"
32+
android:layout_width="0dp"
33+
android:layout_height="wrap_content"
34+
android:layout_weight="1"
35+
android:hint="@string/channel_id"
36+
android:digits="@string/chanel_support_char"/>
37+
38+
<androidx.appcompat.widget.AppCompatButton
39+
android:id="@+id/btn_join"
40+
android:layout_width="wrap_content"
41+
android:layout_height="wrap_content"
42+
android:text="@string/join" />
43+
44+
</LinearLayout>
45+
46+
<androidx.appcompat.widget.AppCompatButton
47+
android:id="@+id/screenShare"
48+
android:layout_width="wrap_content"
49+
android:layout_height="wrap_content"
50+
android:layout_above="@id/ll_join"
51+
android:layout_alignParentEnd="true"
52+
android:layout_marginBottom="24dp"
53+
android:enabled="false"
54+
android:text="@string/screenshare" />
55+
56+
</RelativeLayout>

Android/APIExample/app/src/main/res/navigation/nav_graph.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
<action
8484
android:id="@+id/action_mainFragment_to_channel_encryption"
8585
app:destination="@id/ChannelEncryption" />
86+
<action
87+
android:id="@+id/action_mainFragment_to_two_process_screen_share"
88+
app:destination="@id/TwoProcess" />
8689
</fragment>
8790

8891
<fragment
@@ -206,4 +209,9 @@
206209
android:name="io.agora.api.example.examples.advanced.ChannelEncryption"
207210
android:label="ChannelEncryption"
208211
tools:layout="@layout/fragment_channel_encryption" />
212+
<fragment
213+
android:id="@+id/TwoProcess"
214+
android:name="io.agora.api.example.examples.advanced.TwoProcess"
215+
android:label="TwoProcess"
216+
tools:layout="@layout/fragment_two_process_screen_share" />
209217
</navigation>

Android/APIExample/app/src/main/res/values-zh/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
<string name="item_channelencryption">媒体流加密</string>
8484
<string name="item_setvideoprofile">设置视频编码属性</string>
8585
<string name="item_incallreport">通话中质量监测</string>
86+
<string name="item_twoProcessScreenShare">双进程屏幕共享</string>
8687

8788
<string name="joinchannelaudio">此示例演示了如何使用SDK加入频道进行纯语音通话的功能。</string>
8889
<string name="joinchannelvideo">此示例演示了如何使用SDK加入频道进行音视频通话的功能。</string>
@@ -110,4 +111,5 @@
110111
<string name="channelencryption">此示例演示了在音视频通话过程中如何进行音视频帧的加解密的方法。</string>
111112
<string name="setvideoprofile">此示例演示了在音视频通话过程中如何通过VideoEncoderConfiguration来适配最佳视频性能。</string>
112113
<string name="superresolution">此示例演示了在音视频通话过程中如何使用超级分辨率接口显著提升远端视频显示效果。</string>
114+
<string name="twoProcessScreenShare">此示例演示了在音视频通话过程中如何利用双进程实现同时分享摄像头和屏幕共享。</string>
113115
</resources>

Android/APIExample/app/src/main/res/values/string_configs.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
<!-- <string name="agora_access_token" translatable="false">YOUR ACCESS TOKEN</string>-->
55
<!-- <string name="agora_app_id" translatable="false">266819b117a042a9aa188a67b5daabfb</string>-->
66
<!-- <string name="agora_access_token" translatable="false">006266819b117a042a9aa188a67b5daabfbIACsl0GIdXKqEvmBYWQvl9Anbl3fLGpb298X8JoqA1BJWJzywRwAAAAAEAB65KjRe0LfXgEAAQB7Qt9e</string>-->
7-
<string name="agora_app_id" translatable="false">aab8b8f5a8cd4469a63042fcfafe7063</string>
8-
<string name="agora_access_token" translatable="false"></string>
7+
<string name="agora_app_id" translatable="false">YOUR APP ID</string>
8+
<string name="agora_access_token" translatable="false">YOUR ACCESS TOKEN</string>
99
</resources>

Android/APIExample/app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
<string name="item_setvideoprofile">Set the Video Profile</string>
8888
<string name="item_incallreport">Report In-call Statistics</string>
8989
<string name="item_superresolution">Super Resolution</string>
90+
<string name="item_twoProcessScreenShare">Two Process Screen Sharing</string>
9091

9192
<string name="joinchannelaudio">This example demonstrates how to use the SDK to join channels for voice only calls.</string>
9293
<string name="joinchannelvideo">This example demonstrates how to use the SDK to join channels for audio and video calls.</string>
@@ -114,4 +115,5 @@
114115
<string name="channelencryption">This example demonstrates how to encrypt and decrypt audio and video frames during audio and video calls.</string>
115116
<string name="setvideoprofile">This example demonstrates how to use VideoEncoderConfiguration to adjust video configurations.</string>
116117
<string name="superresolution">This example demonstrates how to use the SDK to display remote video in super resolution.</string>
118+
<string name="twoProcessScreenShare">This example demonstrates how to use additional process to do screen sharing and camera sharing at the same time.</string>
117119
</resources>

Android/APIExample/lib-component/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dependencies {
3535
// api 'io.agora.rtc:full-sdk:3.0.0'
3636
// api 'io.agora.rtc:full-sdk:3.1.2'
3737

38-
api 'io.agora.rtc:full-sdk:3.1.2'
38+
api 'io.agora.rtc:full-sdk:3.1.3'
3939
api 'io.agora:agoraplayer:1.1.2'
4040

4141
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
compileSdkVersion 29
5+
buildToolsVersion "29.0.2"
6+
7+
defaultConfig {
8+
minSdkVersion 19
9+
targetSdkVersion 29
10+
versionCode 1
11+
versionName "1.0"
12+
13+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14+
15+
}
16+
17+
buildTypes {
18+
release {
19+
minifyEnabled false
20+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21+
}
22+
}
23+
24+
}
25+
26+
dependencies {
27+
implementation fileTree(dir: 'libs', include: ['*.jar'])
28+
implementation 'androidx.appcompat:appcompat:1.1.0'
29+
testImplementation 'junit:junit:4.12'
30+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
31+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
32+
api project(path: ':lib-component')
33+
}

0 commit comments

Comments
 (0)