arctos-SDK 程式開發arctos-SDK 程式開發
回到官網
Okuma視訊應用
arctos視訊協作
聯絡我們
  • English
  • 繁體中文
回到官網
Okuma視訊應用
arctos視訊協作
聯絡我們
  • English
  • 繁體中文
  • 指導

    • 起始
  • 規格

    • 點對點直連
    • 中繼伺服器
  • Api

    • 概述
    • 授權
    • 任務
    • 商業
    • 房間
  • 點對點直連

    • 概述
    • 安裝
    • 主要項目

      • 初始設定
      • 房間
      • 攝影機
      • 會議
      • 麥克風
      • 喇叭
      • 分享畫面
        • 啟用螢幕分享
        • 停用螢幕分享
      • 繪圖板
      • 錄影
      • 圖層
  • 中繼伺服器

    • 概述
    • 安裝
    • 主要項目

      • 初始設定
      • 攝影機
      • 麥克風
      • 喇叭
      • 分享畫面
      • 繪圖板
      • 廣播訊息
      • 切換模板
      • 視訊濾鏡

螢幕分享

ArctosLinks.Media 提供了一套 API 來啟用與停用螢幕分享的操作。

啟用螢幕分享

功能:啟用螢幕分享。 返回值:如果成功啟用則完成,若是使用時發生例外狀況,則返回錯誤。

注意事項

螢幕分享功能僅能在會議進行時由會議室主持人使用。值得注意的是:在iOS系統上開啟螢幕分享的情況下,若是使用者啟用系統[原生的螢幕錄影器](https://developer.apple.com/documentation/replaykit/rpscreenrecorder),會發生無法取得影像的狀況。
在Android系統上需要先取得權限同意後才能使用此功能
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);
}

停用螢幕分享

功能:停用螢幕分享。

返回值:如果成功停用則完成,若是使用時發生例外狀況,則返回錯誤。

Swift
import ArctosLinks

private func stopShareScreen() {
    ArctosLinks.Conference.hostStopShareScreen { 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

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
喇叭
Next
繪圖板