调用方法后没有声音 - setVideoProfile()
no sound after call a method - setVideoProfile()
我有一个问题,订阅远程流后我调用了一个方法 - setVideoProfile() 然后就没有声音了
this.client.on('stream-subscribed', (event) => {
let remoteStream = event.stream;
remoteStream.play(bindTag, {fit: 'contain'});
remoteStream.setAudioVolume(100);
remoteStream.setVideoProfile('120p_1');
});
当我评论时 //remoteStream.setVideoProfile('120p_1');
声音正常
我用的是 AgoraRTC v2.8.0
有人遇到过吗?
setAudioVolume 只接受 [0,100] 范围内的数字 - 包括
设置为 0 静音,设置为 100 是最大音量。
您不能传入像“120p_1”这样的任意字符串。这就是为什么你听不到任何声音的原因。
更新 (来自下面的评论)
您不能在远程流上设置视频配置文件。您只能在本地流上设置它。如果您希望用户接收到远程视频的低质量版本,您应该改用双流并设置回退模式
client.enableDualStream(function() {
console.log("Enable dual stream success!")
}, function(err) {
console.log(err)
});
// Configuration for the receiver. When the network condition is poor, receive audio only.
client.setStreamFallbackOption(remoteStream, 2);
查看完整文档:
我有一个问题,订阅远程流后我调用了一个方法 - setVideoProfile() 然后就没有声音了
this.client.on('stream-subscribed', (event) => {
let remoteStream = event.stream;
remoteStream.play(bindTag, {fit: 'contain'});
remoteStream.setAudioVolume(100);
remoteStream.setVideoProfile('120p_1');
});
当我评论时 //remoteStream.setVideoProfile('120p_1');
声音正常
我用的是 AgoraRTC v2.8.0
有人遇到过吗?
setAudioVolume 只接受 [0,100] 范围内的数字 - 包括
设置为 0 静音,设置为 100 是最大音量。
您不能传入像“120p_1”这样的任意字符串。这就是为什么你听不到任何声音的原因。
更新 (来自下面的评论)
您不能在远程流上设置视频配置文件。您只能在本地流上设置它。如果您希望用户接收到远程视频的低质量版本,您应该改用双流并设置回退模式
client.enableDualStream(function() {
console.log("Enable dual stream success!")
}, function(err) {
console.log(err)
});
// Configuration for the receiver. When the network condition is poor, receive audio only.
client.setStreamFallbackOption(remoteStream, 2);
查看完整文档: