|
@@ -62,17 +62,20 @@ export default {
|
|
|
userId: this.userId_,
|
|
|
userSig: res.data,
|
|
|
});
|
|
|
- await this.client_.join({ roomId: this.roomname, role: 'anchor' });
|
|
|
+ await this.client_.join({ roomId: this.roomname, role: 'audience' });
|
|
|
+ this.client_.set
|
|
|
this.client_.on('stream-subscribed', event => {
|
|
|
const remoteStream = event.stream;
|
|
|
// 远端流订阅成功,播放远端音视频流
|
|
|
+ remoteStream.setVideoProfile({ width: '50%', height: 200, float: 'left', frameRate: 15, bitrate: 900 /* kpbs */});
|
|
|
remoteStream.play('look-video');
|
|
|
});
|
|
|
// 监听远端流增加事件
|
|
|
this.client_.on('stream-added', event => {
|
|
|
const remoteStream = event.stream;
|
|
|
// 订阅远端音频和视频流
|
|
|
- this.client_.subscribe(remoteStream, { audio: true, video: true, screen: true }).catch(e => {
|
|
|
+ remoteStream.setScreenProfile({ width: '50%', height: 200, float: 'left', frameRate: 5, bitrate: 1600 /* kbps */});
|
|
|
+ this.client_.subscribe(remoteStream, { audio: false, video: true }).catch(e => {
|
|
|
console.error('failed to subscribe remoteStream');
|
|
|
});
|
|
|
});
|
|
@@ -140,8 +143,13 @@ export default {
|
|
|
border-radius: 10px;
|
|
|
}
|
|
|
#look-video {
|
|
|
+ float: left;
|
|
|
width: 100%;
|
|
|
height: 200px;
|
|
|
grid-area: 1/1/3/4;
|
|
|
+ div {
|
|
|
+ float: left;
|
|
|
+ width: 50%;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|