Bridge Communications

Saturday, July 22, 2017

Skype Web SDK - Part XVI


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 : Receiving a Video Call

Last week we showed you how to initiate a video call.  This week we'll examine how to receive a video call.  We'll do it by allowing the user the choice, but this code could also easily be transformed into an auto answer video kiosk with a few tweaks.  First we'll get our old friend the conversation manager object, then listen for a conversation to be added.  Only if it's possible to enabled video, then we prompt the user to accept the call.  Here is the code;

var conversationsManager = application.conversationsManager; conversationsManager.conversations.added(function (conversation) { conversation.videoService.accept.enabled.when(true, function () { if (showModal('Accept incoming video invitation?')) { conversation.videoService.accept(); conversation.participants.added(function (person) { // person.displayName() has joined the conversation person.video.state.when('Connected', function () { // set up remote video container person.video.channels(0).stream.source.sink.format('Stretch'); person.video.channels(0).stream.source.sink.container(/* DOM node */); }); }); } else { conversation.videoService.reject(); } }); conversation.selfParticipant.video.state.when('Connected', function () { // set up remote video container conversation.selfParticipant.video.channels(0).stream.source.sink.format('Stretch'); conversation.selfParticipant.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 } }); });


Once we accept the call, we'll wait for it to reach the connected state, then render the video in the containers that are defined.

Once we are done we simply end the conversation like any other.

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