|
|
| 行3: |
行3: |
| | [[Unity/Agora/voicechat community/デモ通話]] | | [[Unity/Agora/voicechat community/デモ通話]] |
| | | | |
| − | ==デモから画面共有サンプル作成==
| + | [[Unity/Agora/voicechat community/デモ画面共有]] |
| − | ===DevDemo側サンプルソース解析===
| + | |
| − | *SceneFuncTests.unityのApi_testHelperのGameObjectのFunctionalTest/DevDemo/Test/DVC_ShareScreen.csが、画面共有ソース
| + | |
| − | *TestHome.csのonJoinButtonClicked()からシーン移動している
| + | |
| − | *FunctionalTest/DevDemo/SceneHome2のボタンで、移動できる。
| + | |
| − | | + | |
| − | ====以下"SceneFuncTests"がロードできないというエラーとなる場合====
| + | |
| − | 以下エラーとなる場合
| + | |
| − | 'SceneFuncTests' couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.
| + | |
| − | To add a scene to the build settings use the menu File->Build Settings...
| + | |
| − | PlayerSettingのSceneInBuildにSceneFuncTests.unityを追加すると良い。
| + | |
| − | | + | |
| − | ====以下"SceneFuncTests"がロードできないというエラーとなる場合====
| + | |
| − | 以下エラーとなる場合
| + | |
| − | clientmanager.js:862 Note this API should be replaced by startScreenCaptureForWeb instead.
| + | |
| − | Agora_Unity_WebGL/[build_path]/AgoraWebSDK/libs/clientmanager.js
| + | |
| − | | + | |
| − | startScreenCaptureByDisplayId()はNGで、startScreenCaptureForWebに置き換えるようなエラーが出る。
| + | |
| − | | + | |
| − | 以下の方だとstartScreenCaptureForWebを、実行するサンプルがあるのでそちらを確認する。
| + | |
| − | *Assets/FunctionalTest/NewScreenShareClientManager/AgoraClientManager.cs
| + | |
| − | *Assets/FunctionalTest/NewScreenShareMChannel/AgoraMultiChannel2.cs
| + | |
| − | | + | |
| − | ===NewScreenShareClientManager側サンプルソース解析===
| + | |
| − | *StartScreenButtonを押す
| + | |
| − | *ClientManagerTestシーンは、背景のぼかしオン・オフができる。配信前に画面確認ができない。
| + | |
| − | *MainScreenNewシーンは、背景のぼかしオンができる。オフができない。配信前に画面確認ができる。
| + | |
| − | *NewScreenShareClientチェックは、画面共有時に、動画配信とは別のwindowを開く感じ。その際、画面共有接続には、SCREEN_SHARE_IDが使われる。
| + | |
| − | *ドラッグ移動するコード。makeVideoView()とmakeImageSurface()ののどちらかが.AddComponent<UIElementDragger>();されてること。
| + | |
| − | | + | |
| − | ===="PERMISSION_DENIED"エラーが出た場合====
| + | |
| − | エラー詳細
| + | |
| − | AgoraRTCException: AgoraRTCError PERMISSION_DENIED: NotAllowedError: Permission denied by system
| + | |
| − | | + | |
| − | #macの場合は、macの設定/セキュリティとプライバシー/プライバシー/画面収録/Chromeをonに
| + | |
| − | | + | |
| − | ====配信元画面の大きさを変更====
| + | |
| − | videoSurface.GetComponent<RawImage>().rectTransform.sizeDelta = v2 * 2f;
| + | |
| − | ====配信先画面の大きさを変更====
| + | |
| − | <pre>
| + | |
| − | if (remote)
| + | |
| − | {
| + | |
| − | Vector2 v2 = AgoraUIUtils.GetScaledDimension(640, 360, EnforcingViewLength);
| + | |
| − | videoSurface.GetComponent<RawImage>().rectTransform.sizeDelta = v2 * 2f;
| + | |
| − | remoteUserDisplays.Add(videoSurface.gameObject);
| + | |
| − | UserVideoDict[uid] = videoSurface;
| + | |
| − | }
| + | |
| − | </pre>
| + | |
| − | ====ハンドラ====
| + | |
| − | <pre>
| + | |
| − | channel1.ChannelOnJoinChannelSuccess = Channel1OnJoinChannelSuccessHandler; // 自分が接続開始
| + | |
| − | channel1.ChannelOnLeaveChannel = Channel1OnLeaveChannelHandler; // 自分が退出時
| + | |
| − | channel1.ChannelOnUserJoined = Channel1OnUserJoinedHandler; // 別ユーザが接続してきたとき
| + | |
| − | channel1.ChannelOnError = Channel1OnErrorHandler; // エラー時
| + | |
| − | channel1.ChannelOnUserOffLine = ChannelOnUserOfflineHandler; // 別ユーザーの接続が終了したとき
| + | |
| − | channel1.ChannelOnScreenShareStarted = screenShareStartedHandler_MC; // 自分が映像開始時
| + | |
| − | channel1.ChannelOnScreenShareStopped = screenShareStoppedHandler_MC; // 自分が映像停止時
| + | |
| − | channel1.ChannelOnScreenShareCanceled = screenShareCanceledHandler_MC; // 自分が映像キャンセル時
| + | |
| − | channel1.ChannelOnVideoSizeChanged = onVideoSizeChanged_MCHandler; // 映像サイズ変更時
| + | |
| − | </pre>
| + | |
| − | ====映像の背景ぼやかす====
| + | |
| − | AgoraMultiChannel2のenableVirtualBackground()を動作させる。
| + | |
| − | | + | |
| − | ===="getDisplayMedia"のセキュリティエラーが出る場合====
| + | |
| − | エラー詳細
| + | |
| − | AgoraRTCException: AgoraRTCError UNEXPECTED_ERROR: SecurityError: Failed to execute 'getDisplayMedia' on 'MediaDevices': Access to the feature "display-capture" is disallowed by permission policy.
| + | |
| − | chrome ver94以降だとこのエラーが出るっぽい。iframeを使用しないようにするか、iframeタグないに属性をつけるかすればよい。
| + | |
| − | | + | |
| − | 参考:https://trailblazer.salesforce.com/issues_view?id=a1p4V0000029erUQAQ&title=domexception-failed-to-execute-getdisplaymedia-on-mediadevices-access-to-the-feature-display-capture-is-disallowed-by-permission-policy
| + | |