diff --git a/CHANGES.md b/CHANGES.md
index 17605b4940..2318891f5c 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,7 @@ Features ✨:
Improvements 🙌:
- VoIP : new tiles in timeline
+ - Upgrade Jitsi library from 2.9.3 to 3.1.0
Bugfix 🐛:
- VoIP : fix audio devices output
diff --git a/build.gradle b/build.gradle
index 625ed348be..3da87093ec 100644
--- a/build.gradle
+++ b/build.gradle
@@ -58,9 +58,9 @@ allprojects {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
// Jitsi repo
maven {
- url "https://github.com/vector-im/jitsi_libre_maven/raw/master/android-sdk-2.9.3"
+ url "https://github.com/vector-im/jitsi_libre_maven/raw/master/android-sdk-3.1.0"
// Note: to test Jitsi release you can use a local file like this:
- // url "file:///Users/bmarty/workspaces/jitsi_libre_maven/android-sdk-2.9.3"
+ // url "file:///Users/bmarty/workspaces/jitsi_libre_maven/android-sdk-3.1.0"
}
google()
jcenter()
diff --git a/docs/jitsi.md b/docs/jitsi.md
index 071470b040..ae0e825d08 100644
--- a/docs/jitsi.md
+++ b/docs/jitsi.md
@@ -18,7 +18,7 @@ The generated maven repository is then host in the project https://github.com/ve
Update the script `./tools/jitsi/build_jisti_libs.sh` with the tag of the project `https://github.com/jitsi/jitsi-meet`.
-Currently we are building the version with the tag `android-sdk-2.9.3`.
+Currently we are building the version with the tag `android-sdk-3.1.0`.
### Run the build script
@@ -35,21 +35,21 @@ It will build the Jitsi Meet Android library and put every generated files in th
- Update the file `./build.gradle` to use the previously created local Maven repository. Currently we have this line:
```groovy
-url "https://github.com/vector-im/jitsi_libre_maven/raw/master/android-sdk-2.9.3"
+url "https://github.com/vector-im/jitsi_libre_maven/raw/master/android-sdk-3.1.0"
```
You can uncomment and update the line starting with `// url "file://...` and comment the line starting with `url`, to test the library using the locally generated Maven repository.
-- Update the dependency of the WebRTC library in the file `./matrix-sdk-android/build.gradle`. Currently we have this line:
-
-```groovy
-implementation('com.facebook.react:react-native-webrtc:1.84.0-jitsi-5112273@aar')
-```
-
- Update the dependency of the Jitsi Meet library in the file `./vector/build.gradle`. Currently we have this line:
```groovy
-implementation('org.jitsi.react:jitsi-meet-sdk:2.9.3') { transitive = true }
+implementation('org.jitsi.react:jitsi-meet-sdk:3.1.0') { transitive = true }
+```
+
+- Update the dependency of the WebRTC library in the file `./vector/build.gradle`. Currently we have this line:
+
+```groovy
+implementation('com.facebook.react:react-native-webrtc:1.87.3-jitsi-6624067@aar')
```
- Perform a gradle sync and build the project
@@ -74,9 +74,9 @@ If all the tests are passed, you can export the generated Jitsi library to our M
- Update the file `./build.gradle` to use the previously created Maven repository. Currently we have this line:
```groovy
-url "https://github.com/vector-im/jitsi_libre_maven/raw/master/android-sdk-2.9.3"
+url "https://github.com/vector-im/jitsi_libre_maven/raw/master/android-sdk-3.1.0"
```
- Build the project and perform the sanity tests again.
-- Update the file `/CANGES.md` to notify about the library upgrade, and create a regular PR for project Element Android.
\ No newline at end of file
+- Update the file `/CHANGES.md` to notify about the library upgrade, and create a regular PR for project Element Android.
\ No newline at end of file
diff --git a/tools/jitsi/build_jisti_libs.sh b/tools/jitsi/build_jisti_libs.sh
index 1341a87d10..34051d463c 100755
--- a/tools/jitsi/build_jisti_libs.sh
+++ b/tools/jitsi/build_jisti_libs.sh
@@ -25,8 +25,8 @@ cd jitsi-meet
# This is commit after version 2.2.2, which does not compile
# git checkout 5a934c071a5cbe64de275a25d0ed62d8193cdd03
-# Version android-sdk-2.9.3, commit abcbbbea12e3ef88012b14723bb8cd42dbefc988
-git checkout android-sdk-2.9.3
+# Version android-sdk-3.1.0, commit 7a64bf006ea027b77564d8847570e1ac46ff0ec0
+git checkout android-sdk-3.1.0
echo
echo "##################################################"
diff --git a/vector/build.gradle b/vector/build.gradle
index 770bd728d7..530cb689ca 100644
--- a/vector/build.gradle
+++ b/vector/build.gradle
@@ -435,7 +435,9 @@ dependencies {
// WebRTC
// org.webrtc:google-webrtc is for development purposes only
// implementation 'org.webrtc:google-webrtc:1.0.+'
- implementation('org.jitsi.react:jitsi-meet-sdk:2.9.3') { transitive = true }
+ implementation('org.jitsi.react:jitsi-meet-sdk:3.1.0') { transitive = true }
+ // Transitive dependency from Jitsi, but explicitly declare it
+ implementation('com.facebook.react:react-native-webrtc:1.87.3-jitsi-6624067@aar')
// QR-code
// Stick to 3.3.3 because of https://github.com/zxing/zxing/issues/1170
diff --git a/vector/src/main/AndroidManifest.xml b/vector/src/main/AndroidManifest.xml
index c14eb1045c..6af3ea6733 100644
--- a/vector/src/main/AndroidManifest.xml
+++ b/vector/src/main/AndroidManifest.xml
@@ -36,6 +36,9 @@
android:name="android.permission.WRITE_CALENDAR"
tools:node="remove" />
+
+
+
(), JitsiMeetActivityInterface, JitsiMeetViewListener {
+class VectorJitsiActivity : VectorBaseActivity(), JitsiMeetActivityInterface {
@Parcelize
data class Args(
@@ -63,12 +66,21 @@ class VectorJitsiActivity : VectorBaseActivity(), JitsiMee
injector.inject(this)
}
+ // See https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-android-sdk#listening-for-broadcasted-events
+ private val broadcastReceiver = object : BroadcastReceiver() {
+ override fun onReceive(context: Context?, intent: Intent?) {
+ intent?.let { onBroadcastReceived(it) }
+ }
+ }
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
jitsiViewModel.subscribe(this) {
renderState(it)
}
+
+ registerForBroadcastMessages()
}
override fun initUiAndData() {
@@ -76,7 +88,6 @@ class VectorJitsiActivity : VectorBaseActivity(), JitsiMee
jitsiMeetView = JitsiMeetView(this)
val params = FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)
views.jitsiLayout.addView(jitsiMeetView, params)
- jitsiMeetView?.listener = this
}
private fun renderState(viewState: JitsiCallViewState) {
@@ -132,6 +143,7 @@ class VectorJitsiActivity : VectorBaseActivity(), JitsiMee
override fun onDestroy() {
JitsiMeetActivityDelegate.onHostDestroy(this)
+ unregisterForBroadcastMessages()
super.onDestroy()
}
@@ -154,21 +166,39 @@ class VectorJitsiActivity : VectorBaseActivity(), JitsiMee
JitsiMeetActivityDelegate.onRequestPermissionsResult(requestCode, permissions, grantResults)
}
- override fun onConferenceTerminated(p0: MutableMap?) {
+ private fun registerForBroadcastMessages() {
+ val intentFilter = IntentFilter()
+ for (type in BroadcastEvent.Type.values()) {
+ intentFilter.addAction(type.action)
+ }
+ tryOrNull("Unable to register receiver") {
+ LocalBroadcastManager.getInstance(this).registerReceiver(broadcastReceiver, intentFilter)
+ }
+ }
+
+ private fun unregisterForBroadcastMessages() {
+ tryOrNull("Unable to unregister receiver") {
+ LocalBroadcastManager.getInstance(this).unregisterReceiver(broadcastReceiver)
+ }
+ }
+
+ private fun onBroadcastReceived(intent: Intent) {
+ val event = BroadcastEvent(intent)
+ Timber.v("Broadcast received: ${event.type}")
+ when (event.type) {
+ BroadcastEvent.Type.CONFERENCE_TERMINATED -> onConferenceTerminated(event.data)
+ else -> Unit
+ }
+ }
+
+ private fun onConferenceTerminated(data: Map) {
Timber.v("JitsiMeetViewListener.onConferenceTerminated()")
// Do not finish if there is an error
- if (p0?.get("error") == null) {
+ if (data["error"] == null) {
finish()
}
}
- override fun onConferenceJoined(p0: MutableMap?) {
- Timber.v("JitsiMeetViewListener.onConferenceJoined()")
- }
-
- override fun onConferenceWillJoin(p0: MutableMap?) {
- Timber.v("JitsiMeetViewListener.onConferenceWillJoin()")
- }
companion object {
fun newIntent(context: Context, roomId: String, widgetId: String, enableVideo: Boolean): Intent {