|
@@ -1,4 +1,5 @@
|
|
|
import { Message } from 'element-ui';
|
|
|
+import store from '@/store';
|
|
|
|
|
|
/**
|
|
|
* @description WebSDK 实例化对象
|
|
@@ -33,13 +34,13 @@ export function publishStream() {
|
|
|
console.log('更新上麦结果请求成功,此处可处理应用层逻辑', data);
|
|
|
},
|
|
|
fail: function (data) {
|
|
|
- alert('更新上麦结果请求失败:' + JSON.stringify(data));
|
|
|
+ console.log('更新上麦结果请求失败:' + JSON.stringify(data));
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
fail: function (str) {
|
|
|
// 推流失败,更新上麦结果
|
|
|
- alert(str);
|
|
|
+ console.log('推流失败,更新上麦结果', str);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -90,17 +91,15 @@ export function createLocalStream() {
|
|
|
console.log('创建本地流成功', stream);
|
|
|
// 创建本地流成功,将流展示到id为 live 的dom元素盒子中
|
|
|
stream.show('live');
|
|
|
- getLiveStat({
|
|
|
- success: function (data) {
|
|
|
- // if (!data.started) {
|
|
|
- // startLive();
|
|
|
- // }
|
|
|
- startLive();
|
|
|
- },
|
|
|
- fail: function (str) {
|
|
|
- startLive();
|
|
|
- }
|
|
|
- });
|
|
|
+ publishStream(); // 如果需要立即推流,执行 publish 方法
|
|
|
+ // getLiveStat({
|
|
|
+ // success: function (data) {
|
|
|
+ // console.log(data.started);
|
|
|
+ // },
|
|
|
+ // fail: function (str) {
|
|
|
+ // // startLive();
|
|
|
+ // }
|
|
|
+ // });
|
|
|
},
|
|
|
fail: function (data) {
|
|
|
// 创建本地流失败,应用层处理
|
|
@@ -149,13 +148,16 @@ export function initListener(vue) {
|
|
|
rtc.on('conference_join', () => {
|
|
|
console.log('加入房间成功');
|
|
|
// 有监听就是加入房间成功
|
|
|
- // if (store.state.user.user_type === 'TEACHER') {
|
|
|
- // createLocalStream();
|
|
|
- // }
|
|
|
- createLocalStream();
|
|
|
+ if (store.state.user.user_type === 'TEACHER') {
|
|
|
+ createLocalStream();
|
|
|
+ }
|
|
|
+ // createLocalStream();
|
|
|
});
|
|
|
|
|
|
+ // 新增订阅流事件
|
|
|
rtc.on('allow_sub', function (stream) {
|
|
|
+ let streamType = stream.streamType();
|
|
|
+ console.log(streamType);
|
|
|
if (stream.isMixed()) {
|
|
|
console.log('是混合流,不订阅');
|
|
|
} else {
|
|
@@ -169,7 +171,7 @@ export function initListener(vue) {
|
|
|
stream.show('live', 'contain'); // 将流显示到id为 live 的盒子中
|
|
|
},
|
|
|
fail: function (err) {
|
|
|
- console.log(err);
|
|
|
+ console.log('订阅流失败', err);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -281,14 +283,6 @@ export function closeVideo() {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @method handsUp
|
|
|
- * @description 申请连麦
|
|
|
- */
|
|
|
-export function handsUp(data) {
|
|
|
- rtc.handsUp(data);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
* @method pauseAudio
|
|
|
* @description 关闭本地流声音
|
|
|
*/
|
|
@@ -405,6 +399,14 @@ export function invite(uid) {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * @method handsUp
|
|
|
+ * @description 申请连麦
|
|
|
+ */
|
|
|
+export function handsUp(data) {
|
|
|
+ rtc.handsUp(data);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
* @description 学生端接受老师的上麦邀请,同意上麦
|
|
|
*/
|
|
|
export function inviteAccept() {
|