mirror of https://github.com/OpenVidu/openvidu.git
'Session.unsubscribe(SubscriberTokBox)' method supported
parent
f98194b261
commit
44ee19c75c
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue