Created
June 8, 2020 13:32
-
-
Save hrueger/a992592054d74a603ff90d84ce1b1473 to your computer and use it in GitHub Desktop.
lib-jitsi-meet tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from "@angular/core"; | |
import { AuthenticationService } from "../../_services/authentication.service"; | |
import * as JitsiMeetJS from "../../_libs/lib-jitsi-meet.min.js"; | |
@Component({ | |
selector: "app-home", | |
templateUrl: "./home.component.html", | |
styleUrls: ["./home.component.scss"], | |
}) | |
export class HomeComponent { | |
constructor(public authenticationService: AuthenticationService) { | |
this.jitsi = JitsiMeetJS; | |
} | |
private jitsi: any; | |
private connection: any; | |
private room: any; | |
private options = { | |
hosts: { | |
domain: "meet.jit.si", | |
muc: "conference.meet.jit.si", // FIXME: use XEP-0030 | |
}, | |
bosh: "https://meet.jit.si/http-bind", // FIXME: use xep-0156 for that | |
// The name of client node advertised in XEP-0115 'c' stanza | |
clientNode: "http://jitsi.org/jitsimeet", | |
}; | |
private confOptions = { | |
openBridgeChannel: true, | |
}; | |
private initOptions = { | |
disableAudioLevels: true, | |
// The ID of the jidesha extension for Chrome. | |
desktopSharingChromeExtId: "mbocklcggfhnbahlnepmldehdhpjfcjp", | |
// Whether desktop sharing should be disabled on Chrome. | |
desktopSharingChromeDisabled: false, | |
// The media sources to use when using screen sharing with the Chrome | |
// extension. | |
desktopSharingChromeSources: ["screen", "window"], | |
// Required version of Chrome extension | |
desktopSharingChromeMinExtVersion: "0.1", | |
// Whether desktop sharing should be disabled on Firefox. | |
desktopSharingFirefoxDisabled: true, | |
}; | |
ngOnInit() { | |
this.jitsi.init(this.initOptions); | |
this.connection = this.createConnection(this.options); | |
this.setConnectionListeners(this.connection); | |
this.room = this.connection.initJitsiConference("aseifnlasiylidwueiawjdlxiawhuawhakduyh", this.confOptions); | |
this.setRoomListeners(this.room); | |
this.room.join(); | |
} | |
private createConnection(options: { bosh?: any; hosts: object; useStunTurn?: boolean; enableLipSync?: boolean }): any { | |
return new this.jitsi.JitsiConnection(null, null, options); | |
} | |
private setConnectionListeners(connection: any): void { | |
connection.addEventListener(this.jitsi.events.connection.CONNECTION_ESTABLISHED, this.onConnectionSuccess); | |
connection.addEventListener(this.jitsi.events.connection.CONNECTION_FAILED, this.onConnectionFailed); | |
connection.addEventListener(this.jitsi.events.connection.CONNECTION_DISCONNECTED, this.disconnect); | |
} | |
private setRoomListeners(room: any): void { | |
room.on(this.jitsi.events.conference.TRACK_ADDED, this.onRemoteTrack); | |
room.on(this.jitsi.events.conference.CONFERENCE_JOINED, this.onConferenceJoined); | |
} | |
private onConnectionSuccess(data: any): void { | |
console.log(data); | |
} | |
private onConnectionFailed(data: any): void { | |
console.log(data); | |
} | |
private disconnect(): void { | |
console.log("disconnecting?"); | |
} | |
private onRemoteTrack(data: any): void { | |
console.log(data); | |
} | |
private onConferenceJoined(data: any): void { | |
console.log(data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment