ionic3 - 使用 OpenVidu 仅创建音频通话
问题描述
我只想在不使用网络摄像头的情况下进行音频通话。但以下代码仅适用于相机权限。当我删除相机权限时,它不称为streamCreated事件。
const publisher: Publisher = this.OV.initPublisher(undefined, {
audioSource: undefined, // The source of audio. If undefined default microphone
videoSource: undefined, // The source of video. If undefined default webcam
publishAudio: true, // Whether you want to start publishing with your audio unmuted or not
publishVideo: false, // Whether you want to start publishing with your video enabled or not
resolution: '640x480', // The resolution of your video
frameRate: 30, // The frame rate of your video
insertMode: 'APPEND', // How the video is inserted in the target element 'video-container'
mirror: true // Whether to mirror your local video or not
});
我正在将 Ionic 用于 android 应用程序
解决方案
您需要将“videoSource”设置为“false”而不是“undefined”。像这样的东西应该工作:
const publisher: Publisher = this.OV.initPublisher(undefined, {
audioSource: undefined, // The source of audio. If undefined default microphone
videoSource: false, // The source of video. If undefined default webcam
publishAudio: true, // Whether you want to start publishing with your audio unmuted or not
publishVideo: false, // Whether you want to start publishing with your video enabled or not
resolution: '640x480', // The resolution of your video
frameRate: 30, // The frame rate of your video
insertMode: 'APPEND', // How the video is inserted in the target element 'video-container'
mirror: true // Whether to mirror your local video or not
});
推荐阅读
- java - JSON-Java ClassNotFoundException
- python - 脚本启动频率
- javascript - FullCalendar V4 不使用 IE11 兼容模式呈现
- html - 引导网格没有分解成偶数列
- javascript - npm 在每个命令处崩溃
- c# - NLog AspNetSession Layout Renderer - 从会话中的强类型对象获取值
- java - Javafx (openjfx-11) 在 Netbeans 11 中不起作用。我该怎么办?
- fortran - 在 FORMAT 和 < 之间检测到语法错误
- java - 如何在本地 Tomcat 中启用 TLS 1.2?
- amazon-web-services - DynamoDB 数据迁移和转换