2

我正在尝试通过会议 URI 匿名加入会议,但这似乎不起作用。我访问了 SKYPE UCWA 站点并访问了交互式 SDK - 并尝试从那里匿名加入会议,但该页面没有执行任何操作。

https://ucwa.skype.com/websdk

下面是我尝试匿名加入会议的代码,但对 client.signInManager.signIn 的调用从未完成,也没有引发任何异常。

寻找解决此问题的建议。另外,如果有人有使用 SKYPE web sdk (UCWA) 匿名加入会议的工作代码,请分享。谢谢。

function InitialiseSkype() {
                Skype.initialize({ apiKey: config.apiKey }, function (api) {
                window.skypeWebAppCtor = api.application;
                window.skypeWebApp = new api.application();
                client = new window.skypeWebAppCtor;
                //once intialised, sign in
                           
                alert("Skype SDK Initialized");
                JoinAnonymous();
                
            }, function (err) {
                console.log(err);
                alert('Cannot load the SDK.');
            });
        } 

function JoinAnonymous(){
client.signInManager.signIn({
                version: config.Version,
                name: $('#name').val(),
                meeting: $('#meetingUri').val()
            }).then(function () {
                alert('Signed In, Anonymously');
                var conversation = application.conversationsManager.getConversationByUri(uri);
            }, function (error) {
                alert(error);
            }); 
}

4

3 回答 3

0

Skype For Business Online 似乎还不能使用匿名加入会议。

于 2016-07-14T18:49:11.543 回答
0

实际上,我确实使用该代码匿名登录:

//Init
    var config = {apiKey: 'a42fcebd-5b43-4b89-a065-74450fb91255', // SDK
                 apiKeyCC: '9c967f6b-a846-4df2-b43d-5167e47d81e1' // SDK+UI
                 };

     Skype.initialize({ apiKey: config.apiKey }, function (api) {
         window.skypeWebApp =  new api.application; 
    }, function (err) {
        console.log("cannot load the sdk package", err);
      }); 

//Actual code
    var uri ="sip:xxxxxxxx;gruu;opaque=app:conf:focus:id:xxxxxxxx";
    window.skypeWebApp.signInManager.signIn({
      name: "pseudo",
      meeting:uri
    }).then(function () {
      alert('Signed In, Anonymously');

    }, function (error) {
      alert(error);
    });

我确实连接了 ucwa.skype 交互式 web sdk 页面中给出的 uri。但在那之后我没有设法加入对话,可能是因为交互式样本并没有真正创建房间。

我可以在使用示例帐户登录时从 office365 帐户加入会议。但是我不能匿名加入我的会议室。您尝试使用本地帐户还是使用 office365 帐户?

于 2016-07-13T12:26:16.917 回答
0

WebSDK 的新更新现在支持 SfB Online 的匿名会议加入

(function () {
    'use strict';

    // this will be populated when the auth token is fetched
    // it is later needed to sign into Skype for Business
    var authDetails = {};

    // A reference to the Skype SDK application object
    // set during initialization
    var app;

    displayStep(0);
    registerUIListeners();

    // Initializing the Skype application
    Skype.initialize({
        apiKey: '9c967f6b-a846-4df2-b43d-5167e47d81e1'
    }, function (api) {
        console.log('Skype SDK initialization successful');

        app = api.UIApplicationInstance;

        // Once it is initialized, display a UI prompt for a meeting URL
        displayStep(1);
    }, function (err) {
        console.error('Skype SDK initialization error:', err);
    });

    // After the user submits the meeting URL the next step is to 
    // fetch an auth token
    function getToken(evt) {
        var input = evt.target.querySelector('input'),
            meetingUrl = input.value,
            request = new XMLHttpRequest(),
            data;

        evt.preventDefault();
        console.log('Fetching auth token from meeting url:', meetingUrl);

        function guid() {
            function s4() {
                return Math.floor((1 + Math.random()) * 0x10000)
                .toString(16)
                .substring(1);
            }
            return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
                s4() + '-' + s4() + s4() + s4();
        }

        var sessionId = guid();
        data = 'ApplicationSessionId=' + sessionId +
            '&AllowedOrigins=' + encodeURIComponent(window.location.href) +
            '&MeetingUrl=' + encodeURIComponent(meetingUrl);

        request.onreadystatechange = function () {
            if (request.readyState === XMLHttpRequest.DONE) {
                if (request.status === 200) {
                    var response = JSON.parse(request.response);

                    authDetails.discoverUrl = response.DiscoverUri;
                    authDetails.authToken = "Bearer " + response.Token;

                    console.log('Successfully fetched the anonymous auth token and discoverUrl', authDetails);
                    displayStep(2);
                }
                else {
                    console.error('An error occured, fetching the anonymous auth token', request.responseText);
                }
            }
        };

        request.open('post', 'http://webrtctest.cloudapp.net/getAnonTokenJob');
        request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
        request.send(data);
    }

    // This uses the auth token and discovery URL to sign into Skype
    // and join the meeting
    function joinAVMeeting(evt) {
        var input = evt.target.querySelector('input'),
            name = input.value;

        evt.preventDefault();
        console.log('Joinig meeting as:', name);

        app.signInManager.signIn({
            name: name,
            cors: true,
            root: { user: authDetails.discoverUrl },
            auth: function (req, send) {
                // Send token with all requests except for the GET /discover
                if (req.url != authDetails.discoverUrl)
                    req.headers['Authorization'] = authDetails.authToken;
                return send(req);
            }
        }).then(function () {
            // When joining a conference anonymously, the SDK automatically creates
            // a conversation object to represent the conference being joined
            var conversation = app.conversationsManager.conversations(0);

            console.log('Successfully signed in with anonymous online meeting token');

            registerAppListeners(conversation);

            // This turns on local video and joins the meeting
            startVideoService(conversation);

        }).catch(function (error) {
            console.error('Unable to join conference anonymously:', error);
        });


        function registerAppListeners(conversation) {
            conversation.selfParticipant.video.state.when('Connected', function () {

                console.log('Showing self video');

                document.querySelector('.self').style.display = 'inline-block';
                setupContainer(conversation.selfParticipant.video.channels(0), document.querySelector('.self .video'));
                displayName(document.querySelector('.self'), conversation.selfParticipant);

                console.log('The video mode of the application is:', conversation.videoService.videoMode());

                if (conversation.videoService.videoMode() === 'MultiView') {
                    // Loading the sample in any other browser than Google Chrome means that 
                    // the videoMode is set to 'MultiView'
                    // Please refer to https://msdn.microsoft.com/en-us/skype/websdk/docs/ptvideogroup
                    // on an example on how to implement group video.
                }

                // When in active speaker mode only one remote channel is available.
                // To display videos of multiple remote parties the video in this one channel
                // is switched out automatically, depending on who is currently speaking
                if (conversation.videoService.videoMode() === 'ActiveSpeaker') {
                    var activeSpeaker = conversation.videoService.activeSpeaker;

                    setupContainer(activeSpeaker.channel, document.querySelector('.remote .video'));

                    activeSpeaker.channel.isVideoOn.when(true, function () {
                        document.querySelector('.remote').style.display = 'inline-block';
                        activeSpeaker.channel.isStarted(true);

                        console.log('ActiveSpeaker video is available and has been turned on.');
                    });

                    activeSpeaker.channel.isVideoOn.when(false, function () {
                        document.querySelector('.remote').style.display = 'none';
                        activeSpeaker.channel.isStarted(false);

                        console.log('ActiveSpeaker video is not available anymore and has been turned off.');
                    });

                    // the .participant object changes when the active speaker changes
                    activeSpeaker.participant.changed(function (newValue, reason, oldValue) {
                        console.log('The ActiveSpeaker has changed. Old ActiveSpeaker:', oldValue && oldValue.displayName(), 'New ActiveSpeaker:', newValue && newValue.displayName());

                        if (newValue) {
                            displayName(document.querySelector('.remote'), newValue);
                        }
                    });
                }
            });

            conversation.state.changed(function (newValue, reason, oldValue) {
                if (newValue === 'Disconnected' && (oldValue === 'Connected' || oldValue === 'Connecting')) {
                    console.log('The conversation has ended.');
                    reset();
                }
            });
        }

        function setupContainer(videoChannel, videoDiv) {
            videoChannel.stream.source.sink.format('Stretch');
            videoChannel.stream.source.sink.container(videoDiv);
        }

        function displayName(container, person) {
            container.querySelector('.displayName .detail').innerHTML = person.displayName();
        }

        function startVideoService(conversation) {
            conversation.videoService.start().then(null, function (error) {
                console.error('An error occured joining the conversation:', error);
            });
            displayStep(3);
        }
    }

    function endConversation(evt) {
        var conversation = app.conversationsManager.conversations(0);

        evt.preventDefault();

        conversation.leave().then(function () {
            console.log('The conversation has ended.');
            reset();
        }, function (error) {
            console.error('An error occured ending the conversation:', error);
        }).then(function () {
            reset();
        });
    }


    //-----------------------------------------------------------------------
    //UI helper functions
    function displayStep(step) {
        var nodes = document.querySelectorAll('.step');

        for (var i = 0; i < nodes.length; ++i) {
            var node = nodes[i];

            node.style.display = 'none';

            if (i === step) {
                node.style.display = 'block';
            }
        }
    }

    function registerUIListeners() {
        document.querySelector('.step1').onsubmit = getToken;
        document.querySelector('.step2').onsubmit = joinAVMeeting;
        document.querySelector('.step3').onsubmit = endConversation;
    }

    function reset() {
        window.location = window.location.href;
    }

})();

https://github.com/OfficeDev/skype-docs/blob/master/Skype/WebSDK/samples/Meetings/Anonymous%20Online/standalone/index.js

于 2017-02-18T18:23:12.853 回答