init live

This commit is contained in:
2020-11-12 17:27:59 +08:00
parent 0d29e223e6
commit bc46dde11c
41 changed files with 13590 additions and 575 deletions

45
public/js/presetting.js Normal file
View File

@@ -0,0 +1,45 @@
/* global $ setBtnClickFuc genTestUserSig */
// preset before starting RTC
class Presetting {
init() {
// populate userId/roomId
$('#userId').val('user_30400097');
$('#roomId').val(parseInt(Math.random() * 100000));
const roomId = this.query('roomId');
const userId = this.query('userId');
if (roomId) {
$('#roomId').val(roomId);
}
if (userId) {
$('#userId').val(userId);
}
$('#main-video-btns').hide();
$('.mask').hide();
setBtnClickFuc();
}
query(name) {
const match = window.location.search.match(new RegExp('(\\?|&)' + name + '=([^&]*)(&|$)'));
return !match ? '' : decodeURIComponent(match[2]);
}
login(share, callback) {
let userId = $('#userId').val();
if (share) {
userId = 'share_' + userId;
}
console.log(userId)
const config = genTestUserSig(userId);
const sdkAppId = config.sdkAppId;
const userSig = config.userSig;
const roomId = $('#roomId').val();
callback({
sdkAppId,
userId,
userSig,
roomId
});
}
}