'Session.unsubscribe(SubscriberTokBox)' method supported

pull/3/merge
pabloFuente 2017-04-18 14:09:11 +02:00
parent f98194b261
commit 44ee19c75c
3 changed files with 29 additions and 19 deletions

View File

@ -229,7 +229,17 @@ export class Session {
}
unsuscribe(stream) {
console.log("Unsubscribing from " + stream.getId());
this.openVidu.sendRequest('unsubscribeFromVideo', {
sender: stream.getId()
},
function (error, response) {
if (error) {
console.error(error);
} else {
console.info("Unsubscribed correctly from " + stream.getId());
}
});
}
onParticipantPublished(options) {
@ -462,18 +472,7 @@ export class Session {
});
} else {
console.log("Unsubscribing from " + stream.getId());
this.openVidu.sendRequest('unsubscribeFromVideo', {
sender: stream.getId()
},
function (error, response) {
if (error) {
console.error(error);
} else {
console.info("Unsubscribed correctly from " + stream.getId());
}
});
this.unsuscribe(stream);
}
}

View File

@ -74,11 +74,16 @@ export class OpenViduTokBox {
checkSystemRequirements(): number {
let browser = adapter.browserDetails.browser;
let version = adapter.browserDetails.version;
if ((version == null) && ((browser != 'chrome') && (browser != 'firefox') && (browser != 'edge') && (browser != 'safari'))) {
return 0;
} else {
//Bug fix: 'navigator.userAgent' in Firefox for Ubuntu 14.04 does not return "Firefox/[version]" in the string, so version returned is null
if ((browser == 'firefox') && (version == null)) {
return 1;
}
if (((browser == 'chrome') && (version >= 28)) || ((browser == 'edge') && (version >= 12)) || ((browser == 'firefox') && (version >= 22))) {
return 1;
} else {
return 0;
}
}
getDevices(callback) {

View File

@ -3,6 +3,7 @@ import { Stream } from '../OpenVidu/Stream';
import { OpenViduTokBox } from './OpenViduTokBox';
import { PublisherTokBox } from './PublisherTokBox';
import { SubscriberTokBox } from './SubscriberTokBox';
export class SessionTokBox {
@ -90,13 +91,18 @@ export class SessionTokBox {
}
}
subscribe(stream: Stream, htmlId: string, videoOptions: any);
subscribe(stream: Stream, htmlId: string);
subscribe(stream: Stream, htmlId: string, videoOptions: any): SubscriberTokBox;
subscribe(stream: Stream, htmlId: string): SubscriberTokBox;
subscribe(param1, param2, param3?) {
subscribe(param1, param2, param3?): SubscriberTokBox {
// Subscription
this.session.subscribe(param1);
param1.playOnlyVideo(param2, null);
return new SubscriberTokBox(param1, param2);
}
unsuscribe(subscriber: SubscriberTokBox) {
this.session.unsuscribe(subscriber.stream);
}