52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
/* 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 = window.mid;
|
|
if (share) {
|
|
userId = 'share_' + userId;
|
|
}
|
|
console.log(userId)
|
|
|
|
let sdkAppId;
|
|
let userSig;
|
|
let roomId = window.roomid;
|
|
genTestUserSig(userId).then((res)=>{
|
|
sdkAppId = res.id;
|
|
userSig = res.data
|
|
callback({
|
|
sdkAppId,
|
|
userId,
|
|
userSig,
|
|
roomId
|
|
});
|
|
})
|
|
|
|
|
|
|
|
}
|
|
}
|