devDependencies added. token can be null. clientMetadata can be object
This commit is contained in:
parent
de15a7b482
commit
c45f72d9df
@ -22,5 +22,11 @@
|
||||
"kurento-utils": "6.6.2",
|
||||
"uuid": "~2.0.1",
|
||||
"sdp-translator": "^0.1.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "2.5.2",
|
||||
"browserify": "14.4.0",
|
||||
"tsify": "3.0.1",
|
||||
"uglify-js": "3.0.15"
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -44,15 +44,15 @@ export class Session {
|
||||
}
|
||||
|
||||
connect(token: string, callback: any);
|
||||
connect(token: string, metadata: string, callback: any);
|
||||
connect(token: string, metadata: any, callback: any);
|
||||
|
||||
connect(param1, param2, param3?) {
|
||||
// Early configuration to deactivate automatic subscription to streams
|
||||
if (typeof param2 == "string") {
|
||||
if (param3) {
|
||||
this.session.configure({
|
||||
sessionId: this.session.getSessionId(),
|
||||
participantId: param1,
|
||||
metadata: param2,
|
||||
metadata: this.session.stringClientMetadata(param2),
|
||||
subscribeToStreams: false
|
||||
});
|
||||
this.session.connect(param1, param3);
|
||||
|
||||
@ -82,6 +82,10 @@ export class SessionInternal {
|
||||
}
|
||||
else {
|
||||
|
||||
if (!token) {
|
||||
token = this.randomToken();
|
||||
}
|
||||
|
||||
let joinParams = {
|
||||
token: token,
|
||||
session: this.sessionId,
|
||||
@ -541,4 +545,17 @@ export class SessionInternal {
|
||||
this.participantsSpeaking.splice(pos, 1);
|
||||
}
|
||||
}
|
||||
|
||||
stringClientMetadata(metadata): string {
|
||||
if (!(typeof metadata === 'string')) {
|
||||
return JSON.stringify(metadata);
|
||||
} else {
|
||||
return metadata;
|
||||
}
|
||||
}
|
||||
|
||||
private randomToken(): string {
|
||||
return Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user