Screen Sharing
ArctosLinks.Media
provides an API to enable and disable screen sharing.
Enable Screen Sharing
Function: Enable screen sharing. Return value: If successful, returns completion; if an exception occurs, returns an error.
Note
Screen sharing can only be used by the host during a meeting. Note that on iOS, if the user enables the system's native screen recorder while screen sharing is active, the video will not be captured.
On Android, permission must be granted before using this feature.
Swift
import ArctosLinks
private func startShareScreen() {
ArctosLinks.Conference.hostStartShareScreen { result in
switch result {
case .success():
break
case .failure(let error):
displayNotification(title: "🚨 Process ERROR", body: error.localizedDescription)
}
}
}
Kotlin
import com.arctos.sdk.links.core.application.ArctosLinks
import android.media.projection.MediaProjectionManager
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
private val screenProjectionLauncher: ActivityResultLauncher<Intent> =
registerForActivityResult(
ActivityResultContracts.StartActivityForResult()
) { result ->
if (Activity.RESULT_OK == result?.resultCode) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.hostStartShareScreen(
result.resultCode,
result.data!!
).getOrThrow()
}.onSuccess {
Log.d(TAG, "Successfully start share screen")
}.onFailure {
Log.d(TAG, "Failed : ${it.message}")
}
}
} else {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.hostStopShareScreen().getOrThrow()
}.onFailure {
Log.d(TAG, "Failed to stop share screen: ${it.message} ")
}
}
}
private fun startShareScreen() {
val mediaProjectionManager: MediaProjectionManager =
requireContext().getSystemService(Context.MEDIA_PROJECTION_SERVICE) as MediaProjectionManager
screenProjectionLauncher.launch(mediaProjectionManager.createScreenCaptureIntent())
}
c++
#include "arctos_qt.h"
void startShareScreen() {
arctos_app.media()->setShareScreen(true);
}
Disable Screen Sharing
Function: Disable screen sharing.
Return value: If successful, returns completion; if an exception occurs, returns an error.
Swift
import ArctosLinks
private func stopShareScreen() {
ArctosLinks.Conference.hostStopShareScreen { result in
switch result {
switch result {
case .success():
break
case .failure(let error):
displayNotification(title: "🚨 Process ERROR", body: error.localizedDescription)
}
}
}
Kotlin
import com.arctos.sdk.links.core.application.ArctosLinks
private fun stopShareScreen() {
runCatching {
ArctosLinks.getInstance(Context).conferenceManager.hostStopShareScreen()
.getOrThrow()
}.onSuccess {
Log.d(TAG, "Successfully stop Share Screen")
}.onFailure {
Log.d(TAG, "Failed : ${it.message}")
}
}
c++
#include "arctos_qt.h"
void stopShareScreen() {
arctos_app.media()->setShareScreen(false);
}