我无法理解当前使用演示代码的错误含义
我用来共享屏幕的示例代码,我还安装了共享屏幕所需的 chrome 扩展
screensharing(data) {
AgoraRTC.Logger.setLogLevel(AgoraRTC.Logger.INFO);
var localStreams=[];
var channelKey=null;
if (!this._client) {
Toast.error("Please Join First!");
return;
}
const uid = this._params.uid;
console.log("screen sharing function calling ")
var screenClient = AgoraRTC.createClient({
mode: 'rtc',
codec: 'vp8'
});
screenClient.init(data.appID, function () {
screenClient.join(channelKey, data.channel, null, function (uid) {
// Save the uid of the local stream.
localStreams.push(uid);
// Create the stream for screen sharing.
const streamSpec = {
streamID: uid,
audio: false,
video: false,
screen: true
}
// Set relevant attributes according to the browser.
// Note that you need to implement isFirefox and isCompatibleChrome.
if (isFirefox()) {
streamSpec.mediaSource = 'window';
} else if (!isCompatibleChrome()) {
streamSpec.extensionId = 'minllpmhdgpndnkomcoccfekfegnlikg';
}
var screenStream = AgoraRTC.createStream(streamSpec);
// Initialize the stream.
screenStream.init(function () {
// Play the stream.
screenStream.play('Screen');
// Publish the stream.
screenClient.publish(screenStream);
// Listen to the 'stream-added' event.
screenClient.on('stream-added', function (evt) {
var stream = evt.stream;
var uid = stream.getId()
// Check if the stream is a local uid.
if (!localStreams.includes(uid)) {
console.log('subscribe stream:' + uid);
// Subscribe to the stream.
screenClient.subscribe(stream);
}
})
}, function (err) {
console.log(err);
});
}, function (err) {
console.log(err);
})
});
}
在函数上方,我正在调用共享屏幕
我在浏览器中收到的实际错误消息。
AgoraRTCSDK.min.js:2 12:01:39:329 Agora-SDK [错误]: [850D2] 获取服务器节点失败 [DYNAMIC_USE_STATIC_KEY]
https://webrtc2-ap-web-1.agora.io/api/v1DYNAMIC_USE_STATIC_KEY
AgoraRTCSDK.min.js:2 12:01:39:331 Agora-SDK [INFO]: [850D2] 加入失败: DYNAMIC_USE_STATIC_KEY
当通道使用启用了证书的 appid,但没有传递适当的 token,而是传递 null 时,Agora RTC SDK 会抛出 DYNAMIC_USE_STATIC_KEY 错误。
您需要使用令牌服务器生成动态令牌并将其传递到channelKey而不是null
.
您可以在下面找到如何设置令牌服务器。https://docs.agora.io/en/Interactive%20Broadcast/token_server_cpp?platform=CPP
或者,您可以在控制台中生成临时令牌(https://sso.agora.io/en/login)并将其传递到channelKey以开始开发。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)