Session events API

pull/3/head
pabloFuente 2017-03-29 14:57:45 +02:00
parent 3d6c5d0191
commit e638443cef
2 changed files with 56 additions and 0 deletions

View File

@ -110,6 +110,60 @@ export class Session {
publish() {
this.openVidu.getCamera().publish();
}
onStreamAddedOV(callback) {
this.addEventListener("stream-added", streamEvent => {
callback(streamEvent.stream);
});
}
onStreamRemovedOV(callback) {
this.addEventListener("stream-removed", streamEvent => {
callback(streamEvent.stream);
});
}
onParticipantJoinedOV(callback) {
this.addEventListener("participant-joined", participantEvent => {
callback(participantEvent.participant);
});
}
onParticipantLeftOV(callback) {
this.addEventListener("participant-left", participantEvent => {
callback(participantEvent.participant);
});
}
onParticipantPublishedOV(callback) {
this.addEventListener("participant-published", participantEvent => {
callback(participantEvent.participant);
});
}
onParticipantEvictedOV(callback) {
this.addEventListener("participant-evicted", participantEvent => {
callback(participantEvent.participant);
});
}
onRoomClosedOV(callback) {
this.addEventListener("room-closed", roomEvent => {
callback(roomEvent.room);
});
}
onLostConnectionOV(callback) {
this.addEventListener("lost-connection", roomEvent => {
callback(roomEvent.room);
});
}
onMediaErrorOV(callback) {
this.addEventListener("error-media", errorEvent => {
callback(errorEvent.error)
});
}
/* NEW METHODS */

View File

@ -219,6 +219,8 @@ export class Stream {
if (this.local) {
this.video.muted = true;
} else {
this.video.title = this.getId();
}
if (typeof parentElement === "string") {