
npm install @tencentcloud/call-uikit-vue
debug**ディレクトリをプロジェクトディレクトリ src/debugにコピーします。これは、ローカルで userSig を生成するときに必要です。cp -r node_modules/@tencentcloud/call-uikit-react/debug ./src
xcopy node_modules@tencentcloud\\\\call-uikit-react\\\\debug .\\\\src\\\\debug /i /e
callkit-demo/src/App.vue ファイルにサンプルコードを導入することができます。サンプルコードは**Composition API** の書き方を使っています。<template><span>caller's ID: </span><input type="text" v-model="callerUserID"><button @click="init"> step1. init </button> <br><span> callee's ID: </span><input type="text" v-model="calleeUserID"><button @click="call"> step2. call </button><!--【1】Import the TUICallKit component: Call interface UI --><TUICallKit style="width: 650px; height: 500px " /></template>
SDKAppID、SDKSecretKeyの2つのパラメータを記入 する必要があります。<script setup>import { ref } from 'vue';import { TUICallKit, TUICallKitServer, TUICallType } from "@tencentcloud/call-uikit-vue";import \\* as GenerateTestUserSig from "./debug/GenerateTestUserSig-es"; // Refer to Step 3const SDKAppID = 0; // TODO: Replace with your SDKAppID (Notice: SDKAppID is of type number)const SDKSecretKey = ''; // TODO: Replace with your SDKSecretKeyconst callerUserID = ref('');const calleeUserID = ref('');//【2】Initialize the TUICallKit componentconst init = async () => {const { userSig } = GenerateTestUserSig.genTestUserSig({userID: callerUserID.value,SDKAppID,SecretKey: SDKSecretKey});await TUICallKitServer.init({userID: callerUserID.value,userSig,SDKAppID,});alert('TUICallKit init succeed');}</script>
パラメータ | タイプ | 説明 |
userID | String | ユーザーの一意の識別子。ユーザーが定義するものであり、大文字と小文字の英字(a-z A-Z)、数字(0~9)、アンダースコアとハイフンのみを含めることができます。 |
SDKAppID | Number | Tencent RTC コンソール で音声・動画アプリケーションの一意の識別子を作成します。 |
SDKSecretKey | String | Tencent RTC コンソール で音声・動画アプリケーションの SDKSecretKey を作成します。 |
userSig | String | ユーザーのログイン認証を行い、ユーザーが真実であることを確認し、悪意のある攻撃者による CVM へのアクセスを阻止するためのセキュリティ保護サイン。 |
genTestUserSig関数(ステップ 3.2を参照)を使用して userSig を生成することができます。この方法の SDKSecretKey は逆コンパイル・逆クラックされやすく、キーが漏洩すると、攻撃者はお客様の Tencent Cloud トラフィックを盗むことができます。//【3】Make a 1v1 video callconst call = async () => {await TUICallKitServer.call({userID: calleeUserID.value,type: TUICallType.VIDEO_CALL,});};
step1. init をクリックしてログインします(発呼側と着呼側)。
step2. call ** をクリックして電話をかけます。通話に問題がある場合は、よくある質問を参照してください。
フィードバック