|
@@ -62,16 +62,19 @@ export default {
|
|
userId: this.userId_,
|
|
userId: this.userId_,
|
|
userSig: res.data,
|
|
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 => {
|
|
this.client_.on('stream-subscribed', event => {
|
|
const remoteStream = event.stream;
|
|
const remoteStream = event.stream;
|
|
// 远端流订阅成功,播放远端音视频流
|
|
// 远端流订阅成功,播放远端音视频流
|
|
|
|
+ remoteStream.setVideoProfile({ width: '50%', height: 200, float: 'left', frameRate: 15, bitrate: 900 /* kpbs */});
|
|
remoteStream.play('look-video');
|
|
remoteStream.play('look-video');
|
|
});
|
|
});
|
|
// 监听远端流增加事件
|
|
// 监听远端流增加事件
|
|
this.client_.on('stream-added', event => {
|
|
this.client_.on('stream-added', event => {
|
|
const remoteStream = event.stream;
|
|
const remoteStream = event.stream;
|
|
// 订阅远端音频和视频流
|
|
// 订阅远端音频和视频流
|
|
|
|
+ remoteStream.setScreenProfile({ width: '50%', height: 200, float: 'left', frameRate: 5, bitrate: 1600 /* kbps */});
|
|
this.client_.subscribe(remoteStream, { audio: false, video: true }).catch(e => {
|
|
this.client_.subscribe(remoteStream, { audio: false, video: true }).catch(e => {
|
|
console.error('failed to subscribe remoteStream');
|
|
console.error('failed to subscribe remoteStream');
|
|
});
|
|
});
|