Cookie CSS

Saturday, July 15, 2017

Skype Web SDK - Part XV

What is the Skype Web SDK?

The Skype Developer Platform for Web ("Skype Web SDK") is a set of JavaScript Web APIs and HTML controls that enable you to build web experiences that seamlessly integrate a wide variety of real-time collaboration models leveraging Skype for Business services and the larger Skype network. It provides support for multiple core collaboration services like presence, chat, audio, and video, enabling web experiences across a broad spectrum of users, platforms, and devices.



Today's Topic : Let's Initiate a Video Call

Last week we showed you how to add video to an existing P2P call, so this week we will step through how to start a call with the video already enabled.  The key takeaway from this week is you still have to wait until the call is connected before you trigger the video display, so we will set up 4 listeners to go along with the 3 lines of code that actually make the call.

var conversationsManager = application.conversationsManager; conversation = conversationsManager.getConversation('sip:xxx'); conversation.selfParticipant.video.state.when('Connected', function () { // set up self video container conversation.selfParticipant.video.channels(0).stream.source.sink.format('Stretch'); conversation.selfParticipant.video.channels(0).stream.source.sink.container(/* DOM node */); }); conversation.participants.added(function (person) { // person.displayName() has joined the conversation person.video.state.when('Connected', function () { // set up self video container person.video.channels(0).stream.source.sink.format('Stretch'); person.video.channels(0).stream.source.sink.container(/* DOM node */); }); }); conversation.state.changed(function (newValue, reason, oldValue) { if (newValue === 'Disconnected' && (oldValue === 'Connected' || oldValue === 'Connecting')) { // conversation ended } }); conversation.videoService.start().then(null, function (error) { // handle error });

You can see the top 2 lines, and last 3 lines are all that is really involved in making the call.  The rest of the code are listeners, so for example when the video state becomes connected, we display the video of that person.  There is also a listener for us to watch our own state and connect and display the self participant video.  From here all we need to do is end the conversation with this familiar code.


conversation.leave().then(function () { // conversation ended }, function (error) { // handle error }).then(function () { // clean up operations });



Doug Routledge, C# Lync, Skype for Business, SQL, Exchange, UC, 
Full Stack Developer  BridgeOC Bridge Operator Console
Twitter - @droutledge @ndbridge















No comments:

Post a Comment

Any spam comments will be deleted and your user account will be disabled.