这是用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/