We are implementing the Agora screen sharing and getting error DYNAMIC_USE_STATIC_KEY

雨燕双飞 提交于 2021-01-19 09:12:47

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/60648919/we-are-implementing-the-agora-screen-sharing-and-getting-error-dynamic-use-stati

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!