javascript - We are implementing the Agora screen sharing and getting error DYNAMIC_USE_STATIC_KEY - Stack Overflow

I am unable to understand the Error meaning currently using the demo code Sample code which I am using

I am unable to understand the Error meaning currently using the demo code

Sample code which I am using to share the screen and I also install the chrome extension which is required to share the screen

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);
            })
        });
    }

Above the function, I am calling to share the screen

Actual error message i am getting in browser .

  • AgoraRTCSDK.min.js:2 12:01:39:329 Agora-SDK [ERROR]: [850D2] Get server node failed [DYNAMIC_USE_STATIC_KEY]
    DYNAMIC_USE_STATIC_KEY

  • AgoraRTCSDK.min.js:2 12:01:39:331 Agora-SDK [INFO]: [850D2] Join failed: DYNAMIC_USE_STATIC_KEY

I am unable to understand the Error meaning currently using the demo code

Sample code which I am using to share the screen and I also install the chrome extension which is required to share the screen

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);
            })
        });
    }

Above the function, I am calling to share the screen

Actual error message i am getting in browser .

  • AgoraRTCSDK.min.js:2 12:01:39:329 Agora-SDK [ERROR]: [850D2] Get server node failed [DYNAMIC_USE_STATIC_KEY]
    https://webrtc2-ap-web-1.agora.io/api/v1 DYNAMIC_USE_STATIC_KEY

  • AgoraRTCSDK.min.js:2 12:01:39:331 Agora-SDK [INFO]: [850D2] Join failed: DYNAMIC_USE_STATIC_KEY

Share Improve this question asked Mar 12, 2020 at 6:48 pawansgi92pawansgi92 1,1351 gold badge14 silver badges33 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

DYNAMIC_USE_STATIC_KEY error is thrown by Agora RTC SDK when the channel is using an appid which has certificates enabled but instead of passing the appropriate token, null is being passed.

You need to use a token server to generate a dynamic token and pass it onto channelKey instead of null.

You can find how to setup a token server below. https://docs.agora.io/en/Interactive%20Broadcast/token_server_cpp?platform=CPP

Alternatively, you can generate a temporary token in the console (https://sso.agora.io/en/login) and pass it onto channelKey for getting started with development.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744817082a4595390.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信