如何在没有身份验证问题的情况下在 agora 中进行屏幕共享
How to do screen sharing in agora without getting an authentication problem
我已经实现了视频通话的 agora sdk 3.0。
现在我正在尝试让屏幕共享正常工作,但我不断收到中提供的错误
下图(加入失败:NO_AUTHORIZED)。
Picture of console while sharing a screen
屏幕共享代码示例:
async shareScreen() {
this.shareClient = AgoraRTC.createClient({
mode: 'rtc',
codec: 'vp8'
})
this.shareClient.init('xxxxxxxxxxxxxx', () => {
this.shareClient.join('same token video call started with', 'same room name of current outgoing video call', null, (uid) => {
const streamSpec = {
streamID: uid,
audio: false,
video: false,
screen: true
}
if (isFirefox()) {
streamSpec.mediaSource = 'window';
} else if (!isCompatibleChrome()) {
streamSpec.extensionId = 'minllpmhdgpndnkomcoccfekfegnlikg';
}
this.shareScreenStream = AgoraRTC.createStream(streamSpec);
// Initialize the stream.
this.shareScreenStream.init(() => {
// Play the stream.
this.shareScreenStream.play('renderer');
// Publish the stream.
this.shareClient.publish(this.shareScreenStream);
}, function(err) {
console.log(err);
});
}, function(err) {
console.log(err);
})
});
},
屏幕共享客户端应使用基于 UID 和频道名称的唯一令牌。不是主要用户使用的那个。
我已经实现了视频通话的 agora sdk 3.0。
现在我正在尝试让屏幕共享正常工作,但我不断收到中提供的错误 下图(加入失败:NO_AUTHORIZED)。
Picture of console while sharing a screen
屏幕共享代码示例:
async shareScreen() {
this.shareClient = AgoraRTC.createClient({
mode: 'rtc',
codec: 'vp8'
})
this.shareClient.init('xxxxxxxxxxxxxx', () => {
this.shareClient.join('same token video call started with', 'same room name of current outgoing video call', null, (uid) => {
const streamSpec = {
streamID: uid,
audio: false,
video: false,
screen: true
}
if (isFirefox()) {
streamSpec.mediaSource = 'window';
} else if (!isCompatibleChrome()) {
streamSpec.extensionId = 'minllpmhdgpndnkomcoccfekfegnlikg';
}
this.shareScreenStream = AgoraRTC.createStream(streamSpec);
// Initialize the stream.
this.shareScreenStream.init(() => {
// Play the stream.
this.shareScreenStream.play('renderer');
// Publish the stream.
this.shareClient.publish(this.shareScreenStream);
}, function(err) {
console.log(err);
});
}, function(err) {
console.log(err);
})
});
},
屏幕共享客户端应使用基于 UID 和频道名称的唯一令牌。不是主要用户使用的那个。