|
@@ -56,13 +56,12 @@ export default {
|
|
|
data: function() {
|
|
|
return {
|
|
|
client_: '',
|
|
|
- localStream_: '',
|
|
|
sdkAppId_: '1400380125',
|
|
|
cameras: [],
|
|
|
microphones: [],
|
|
|
cameraId: '',
|
|
|
microphoneId: '',
|
|
|
- userSig_: '',
|
|
|
+ userId_: '1111',
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -76,19 +75,21 @@ export default {
|
|
|
this.microphones = await TRTC.getMicrophones();
|
|
|
},
|
|
|
async initclient() {
|
|
|
- const res = await this.gensignFetch(this.user.uid);
|
|
|
+ console.log(this.user.uid);
|
|
|
+ this.userId_ = this.user.uid;
|
|
|
+ const res = await this.gensignFetch({ userid: this.userId_ });
|
|
|
if (this.$checkRes(res)) {
|
|
|
- this.userSig_ = res.data;
|
|
|
- console.log(res);
|
|
|
+ console.log(res.data);
|
|
|
this.client_ = TRTC.createClient({
|
|
|
mode: 'live',
|
|
|
sdkAppId: this.sdkAppId_,
|
|
|
- userId: this.user.uid,
|
|
|
+ userId: this.userId_,
|
|
|
userSig: res.data,
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
async liveon() {
|
|
|
+ console.log('8888--' + this.userId_);
|
|
|
if (this.cameraId === '' || this.microphoneId === '') {
|
|
|
this.$message({
|
|
|
message: '请选择摄像头和麦克风',
|
|
@@ -97,12 +98,12 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
await this.client_.join({ roomId: this.name, role: 'anchor' });
|
|
|
- const localStream_ = TRTC.createStream({
|
|
|
+ const localStream_ = await TRTC.createStream({
|
|
|
audio: true,
|
|
|
video: true,
|
|
|
cameraId: this.cameraId,
|
|
|
microphoneId: this.microphoneId,
|
|
|
- userId: this.user.uid,
|
|
|
+ userId: this.userId_,
|
|
|
});
|
|
|
await localStream_.initialize();
|
|
|
console.log('initialize local stream success');
|
|
@@ -112,8 +113,8 @@ export default {
|
|
|
//$('#mask_main').appendTo($('#player_' + this.localStream_.getId()));
|
|
|
},
|
|
|
async shareon() {
|
|
|
- const shareId = 'share-' + this.user.uid;
|
|
|
- const res = await this.gensignFetch(shareId);
|
|
|
+ const shareId = 'share-' + this.userId_;
|
|
|
+ const res = await this.gensignFetch({ userid: shareId });
|
|
|
if (this.$checkRes(res)) {
|
|
|
const shareClient = TRTC.createClient({
|
|
|
mode: 'videoCall',
|