翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
Amazon Connect Streams JS を使用して、ビデオ通話と画面共有をカスタムエージェントデスクトップに統合する
このトピックは開発者を対象としています。カスタムエージェントデスクトップの場合、ビデオ通話と画面共有をサポートするように変更を加える必要があります。高レベルのステップは、次のとおりです。
注記
CCP をカスタムエージェントアプリケーションに直接埋め込む場合は、Amazon Connect Streams JSallowFramedVideoCall
が true に設定されていることを必ず確認します。
-
Amazon Connect Streams JS
を使用して、受信したコンタクトが WebRTC コンタクトであるかどうかを確認します。次のコード例のとおり "connect:WebRTC"
コンタクトサブタイプを使用します。contact.getContactSubtype() === "connect:WebRTC"
-
顧客の表示名は、
contact contact.getName()
の名前フィールドを使用して取得できます。
ビデオのサポートを追加する
顧客がビデオ処理を有効に設定している場合に、ビデオ処理のサポートを追加するには、次の手順を実行します。
-
コンタクトに動画機能があるかを確認するには、次を行います。
// Return true if any connection has video send capability contact.hasVideoRTCCapabilities() // Return true if the agent connection has video send capability contact.canAgentSendVideo() // Return true if other non-agent connection has video send capability contact.canAgentReceiveVideo()
-
エージェントがビデオ通話を処理する動画アクセス権限を持っているかを確認するには、次を行います。
agent.getPermissions().includes('videoContact');
-
ビデオ通話を受け入れるには、コンタクトが動画機能を備えている必要があり、エージェントには動画アクセス権限が必要です。
function shouldRenderVideoUI() { return contact.getContactSubtype() === "connect:WebRTC" && contact.hasVideoRTCCapabilities() && agent.getPermissions().includes('videoContact'); }
-
動画セッションに参加するには、
getVideoConnectionInfo
を呼び出します。if (shouldRenderVideoUI()) { const response = await contact.getAgentConnection().getVideoConnectionInfo(); }
-
動画 UI を作成してビデオ会議セッションに参加するには、次を参照してください。
-
分かりやすいように、次のコードスニペットでは Amazon Chime SDK React コンポーネントライブラリの例を使用しています。
import { MeetingSessionConfiguration } from "amazon-chime-sdk-js"; import { useMeetingStatus, useMeetingManager, MeetingStatus, DeviceLabels, useLocalAudioOutput } from 'amazon-chime-sdk-component-library-react'; const App = () => ( <MeetingProvider> <MyVideoManager /> </MeetingProvider> ); const MyVideoManager = () => { const meetingManager = useMeetingManager(); if (shouldRenderVideoUI()) { const response = await contact.getAgentConnection().getVideoConnectionInfo(); const configuration = new MeetingSessionConfiguration( response.meeting, response.attendee); await meetingManager.join(configuration, { deviceLabels: DeviceLabels.Video }); await meetingManager.start(); } function endContact() { meetingManager.leave(); } }
-
ビデオグリッドをレンダリングするには、 Amazon Chime SDK React コンポーネントライブラリの VideoTileGrid
を使用するか、RemoteVideoTileProvider を使用して UI の動作をカスタマイズします。 -
ビデオプレビューをレンダリングするには、VideoPreview
コンポーネントと CameraSelection コンポーネントを使用できます。会議中にカメラビデオを選択したり変更したりするには、 meetingManager.selectVideoInputDevice
またはmeetingManager.startVideoInput
を使用できます。const meetingManager = useMeetingManager(); const { isVideoEnabled } = useLocalVideo(); if (isVideoEnabled) { await meetingManager.startVideoInputDevice(current); } else { meetingManager.selectVideoInputDevice(current); }
-
背景ぼかしを実装するには、useBackgroundBlur
を参照してください。 -
カスタム動画エクスペリエンスを構築する方法のサンプルコードについては、この Amazon Chime SDK サンプルの Amazon Chime React 会議のデモ
を参照してください。
画面共有のサポートを追加する
注記
すぐに使える CCP をカスタムエージェントアプリケーションで直接使用する場合は、Amazon Connect Streams JSallowFramedScreenSharing
と allowFramedScreenSharingPopUp
が true に設定されていることを必ず確認します。
allowFramedScreenSharing
を true に設定すると、1 つのウィンドウまたはタブ内の 1 つの CCP でのみ画面共有ボタンが有効になります。allowFramedScreenSharingPopUp
を true に設定すると、エージェントが画面共有ボタンを選択したときに、画面共有アプリが別のウィンドウで起動します。詳細については、Amazon Connect Streams JS
カスタムエージェントデスクトップで画面共有を有効にするには、次の手順を実行します。
-
問い合わせに画面共有機能があるかどうかを確認します。
// Return true if any connection has screen sharing send capability contact.hasScreenShareCapability() // Return true if the agent connection has screen sharing send capability contact.canAgentSendScreenShare() // Return true if customer connection has screen sharing send capability contact.canCustomerSendScreenShare()
-
エージェントにビデオのアクセス許可があるかどうかを確認します。
agent.getPermissions().includes('videoContact');
-
エージェントが対象となる問い合わせの画面共有セッションを開始できるかどうかを確認します。
fun canStartScreenSharingSession() { return contactgetContactSubtype() === "connect:WebRTC" && contact.hasScreenShareCapability() && agent.getPermissions().includes('videoContact'); }
-
startScreenSharing
を呼び出して画面共有セッションを開始します。これにより、ScreenSharingActivated
が問い合わせに追加され、問い合わせレコードで検索できるようになります。contact.startScreenSharing();
-
getVideoConnectionInfo
を呼び出してセッションに参加します。エージェントがビデオセッションに参加してビデオを処理している場合は、この手順をスキップできます。if (canStartScreenSharingSession) { contact.startScreenSharing(); const response = await contact.getAgentConnection().getVideoConnectionInfo(); }
-
Amazon Chime SDK React Components Library を使用してセッションに参加します。コードスニペットについては、「ビデオのサポートを追加する」の手順 6 を参照してください。
-
Amazon Chime SDK React コンポーネントから同じ VideoTileGrid
を使用して、画面共有ビデオタイルを描画します。詳細については、useContentShareState と useContentShareControls を参照してください。 -
セッションが終了したら
stopScreenSharing
を呼び出します。contact.stopScreenSharing();
-
次のコールバックをサブスクライブすることで、画面共有アクティビティのイベントを受信できます:
initScreenSharingListeners() { this.contact.onScreenSharingStarted(() => { // Screen sharing session started }); this.contact.onScreenSharingStopped(() => { // Screen sharing session ended }); this.contact.onScreenSharingError((error) => { // Screen sharing session error occurred }); } }