這是用JavaScript編寫的一對視頻呼叫客戶端應用程序的示例,該應用程序允許開發人員在其網站中實現帶有face AI的視頻通話功能。該應用程序在Web瀏覽器上運行(稱為客戶端終點),並利用Enablex Web SDK通過Enablex Video Services與其對等方進行RTC會話。客戶端應用程序執行以下任務來促進RTC會話:
從應用程序服務器中獲取令牌,使用令牌發布的音頻/視頻流在房間中訂閱的遠程音頻/視頻流中的任何相關事件此示例客戶端應用程序還展示了以下功能:
靜音/取消靜音視頻靜音/取消靜音音頻會話記錄聊天面AI屏幕分享斷開連接
使用enxrtc.js(在客戶端/JS中)開發客戶端應用程序時,請確保用https://developer.enablex.io/develiper.io/docs/references/references/references/sdks/sdks/sdks/video-sdk/web-sdk/weect and for https://developer.enablex.io/develiper.io/develiper.io/develiper.io/develicer.io/develicer.io/web getpe and for enxrtc.js polyfills替換舊的enxrtc.js。否則,您的應用程序將無法在Web瀏覽器中使用。
註冊免費試用https://www.enablex.io/free-trial/或嘗試我們的多階段視頻聊天https://try.enablex.io/
git clone https://github.com/EnableX/Video-Conferencing-Open-Source-Web-Application-Sample.git --recursive並進一步執行步驟該應用程序需要在HTTPS上運行。因此,您需要為域使用有效的SSL證書,並將應用程序指向使用它們。
但是,您可以使用自簽名證書在本地運行此應用程序。有許多網站可以為您生成一個自簽名的證書,Google IT。其中很少有:
以下以下內容也可以用於創建自簽名證書。
Linux/Mac
cd Video - Conferencing - Open - Source - Web - Application - Sample
cd server
mkdir certs
sudo openssl req - x509 - newkey rsa: 4096 - keyout . / certs / example . key - out . / certs / example . crt - days 10000 - nodes
sudo chmod 755 . / certs / example . *
cd . .Windows(使用git bash)
cd Video - Conferencing - Open - Source - Web - Application - Sample
cd server
mkdir certs
openssl req - x509 - newkey rsa: 4096 - keyout . / certs / example . key - out . / certs / example . crt - days 10000 - nodes
chmod 755 . / certs / example . *
cd . . 在運行此應用程序之前,請配置服務。將server/example.env複製為server/.env並更新值。或者,您可以將以下系統環境變量設置為:
SERVICE_PORT - Node port on which your application will run . Default port set is 3000
ENABLEX_APP_ID - Your EnableX `App ID` - It 's your username for EnableX API and can be found at Dashboard > Projects https://portal.enablex.io/dashboard/
ENABLEX_APP_KEY - Your EnableX `App Key` - - It 's your password for EnableX API and can be found at Dashboard > Projects https://portal.enablex.io/dashboard/對於Mac和Linux,打開一個終端窗口並鍵入以下命令。注意 - = =用enablex帳戶中的值替換所有字符:
export SERVICE_PORT = XXXX
export ENABLEX_APP_ID = XXXXXXXXXX
export ENABLEX_APP_KEY = XXXXXXXXX在Windows上,打開PowerShell /命令窗口,然後鍵入以下命令。請注意,沒有= ,只是一個空間隔開的密鑰和值:
setx SERVICE_PORT 'XXXX'
setx ENABLEX_APP_ID 'XXXXXXXXX'
setx ENABLEX_APP_KEY 'XXXXXXXXX'運行npm install --save ,構建工件將存儲在./node_modules目錄中。
在server文件夾內運行node server.js以啟動服務器。
cd server
node server . js Enablex Server API是一種REST API服務,旨在從合作夥伴的應用程序服務器中調用,以提供啟用視頻會議室。通過分配的應用程序ID和應用程序鍵對每個應用程序訪問API訪問。因此,應用程序ID和應用程序鍵分別用作用戶名和密碼,以通過HTTP基本身份驗證標頭傳遞以訪問服務器API。
對於此應用程序,使用以下服務器API調用:
要了解有關服務器API的更多信息,請訪問:https://developer.enablex.io/docs/refereness/apis/video-api/index/
客戶端端點應用程序使用Web Toolkit enxrtc.js與Enablex服務器進行通信以啟動和管理RTC通信。
要了解有關客戶端API的更多信息,請訪問:https://developer.enablex.io/docs/references/sdks/video-sdk/web-sdk/web-sdk/index/