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 : Adding Video to an Existing Call
This week we'll look at what it takes to escalate an audio call to a video call. On a separate note, in the weeks leading up to Microsoft Ignite, I'll reveal some cool projects built with the technology from this blog series.
For today let's look at how we react to a remote party enabling their video.
var conversationsManager = application.conversationsManager;
conversation = conversationsManager.getConversation('sip:xxx');
conversation.selfParticipant.video.state.when('Connected', function () {
// set up local 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 remote video container
person.video.channels(0).stream.source.sink.format('Stretch');
person.video.channels(0).stream.source.sink.container(/* DOM node */);
if (conversation.isGroupConversation()) {
person.video.channels(0).isStarted(true);
}
});
});
});
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
});
First we setup a place to hold the incoming video. Then we'll listen for them to enable it.
person.video.channels(0).isVideoOn.when(true, function () {
// person.displayName() started streaming their video
});
person.video.channels(0).isVideoOn.when(false, function () {
// person.displayName() stopped streaming their video
});
We can also add another party to the call
conversation.participants.add('sip:xxx').then(function () {
// participant successfully added
}, function (error) {
// handle error
});
And when we are done, end the conversation.
conversation.leave().then(function () {
// conversation ended
}, function (error) {
// handle error
}).then(function () {
// clean up operations
});
Next week we'll look at what it takes to do a group video conversation.
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.