arctos-SDK For developsarctos-SDK For develops
Home
Okuma
arctos
Contact
  • English
  • 繁體中文
Home
Okuma
arctos
Contact
  • English
  • 繁體中文
  • Guide

    • get-started
  • Spec

    • Peer to Peer Direct
    • Relay based
  • Api

    • Overview
    • Auth
    • Task
    • Business
    • Room
  • Peer to Peer Direct

    • overview
    • installization
    • features

      • initial_setting
      • room
      • camera
      • conference
      • microphone
      • speaker
      • share_screen
        • Enable Screen Sharing
        • Disable Screen Sharing
      • paint_board
      • recording
      • layout
  • Relay based

    • overview
    • installization
    • features

      • initial_setting
      • camera
      • microphone
      • speaker
      • share_screen
      • paint_board
      • share_message
      • switch_template
      • video_filters

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);
}
Prev
speaker
Next
paint_board