|
@@ -1,3 +1,4 @@
|
|
|
+import store from '@/store';
|
|
|
import { Message } from 'element-ui';
|
|
|
import { rtc, publishStream, closeVideo } from '@/views/live/common';
|
|
|
export {
|
|
@@ -53,20 +54,26 @@ export function initListener(vue) {
|
|
|
success: str => {
|
|
|
console.log('举手成功', str);
|
|
|
console.log('创建本地流推流');
|
|
|
+ let device = store.state.app.liveDevice;
|
|
|
+ let video =
|
|
|
+ device.video.length > 0
|
|
|
+ ? { device: 'camera', resolution: 'vga', deviceId: device.video }
|
|
|
+ : false;
|
|
|
+ let audio = device.audio.length > 0 ? { deviceId: device.audio } : false;
|
|
|
const createData = {
|
|
|
- video: true,
|
|
|
- audio: true
|
|
|
+ video,
|
|
|
+ audio
|
|
|
};
|
|
|
rtc.createLocalStream({
|
|
|
streamName: 'picture',
|
|
|
createData,
|
|
|
- success: function (stream) {
|
|
|
+ success(stream) {
|
|
|
console.log('创建本地流成功', stream);
|
|
|
// 创建本地流成功,将流展示到id为 student 的dom元素盒子中
|
|
|
stream.show('group-local');
|
|
|
publishStream('picture'); // 如果需要立即推流,执行 publish 方法
|
|
|
},
|
|
|
- fail: function (data) {
|
|
|
+ fail(data) {
|
|
|
console.log('创建本地流失败,应用层处理', data);
|
|
|
// 创建本地流失败,应用层处理
|
|
|
Message({
|