|
@@ -12,7 +12,8 @@ import {
|
|
|
|
|
|
import i18n from '@/locales/i18n';
|
|
|
|
|
|
-const { closeVideo, getHistory, unSubscribeStream, createData, publishStream } = useLive();
|
|
|
+const { closeVideo, getHistory, unSubscribeStream, createData, publishStream, pauseAudio, sendPublishMessage } =
|
|
|
+ useLive();
|
|
|
|
|
|
export let room_id = ref('');
|
|
|
export let session_id = ref('');
|
|
@@ -24,7 +25,8 @@ export let studentSelf = ref({
|
|
|
export let group_instance_mark = ref(''); // 所在组的实例标记号
|
|
|
export let audience_list = ref([]); // 旁听学员列表
|
|
|
export let is_example_group = ref(false); // 是否是示范组
|
|
|
-export let isAudience = ref(false);
|
|
|
+export let isAudience = ref(false); // 是否是旁听学员
|
|
|
+export let room_user_id = ref(''); // 房间用户id
|
|
|
|
|
|
export let isLocalStream = ref(false); // 是否有本地流
|
|
|
// let hasVideo = ref(false);
|
|
@@ -87,6 +89,7 @@ export function useInitListener({ streamList, roomContext, is_teacher_in_group,
|
|
|
// console.log(str);
|
|
|
// }
|
|
|
// });
|
|
|
+ if (isAudience.value) return;
|
|
|
if (studentSelf.value.is_teacher_role_in_room === 'false') {
|
|
|
rtc.value.handsUp({
|
|
|
success: (str) => {
|
|
@@ -251,6 +254,25 @@ export function useInitListener({ streamList, roomContext, is_teacher_in_group,
|
|
|
// }
|
|
|
// chatList.value.push(dat);
|
|
|
// });
|
|
|
+
|
|
|
+ rtc.value.on('publish_message', (data) => {
|
|
|
+ console.log('监听发布消息', data);
|
|
|
+
|
|
|
+ if (data.type === 'estoppel' && room_user_id.value === data.room_user_id) {
|
|
|
+ pauseAudio({
|
|
|
+ streamName: 'picture',
|
|
|
+ success: () => {
|
|
|
+ Message.success(i18n.t('Key435'));
|
|
|
+ sendPublishMessage({ type: 'estoppel-success' });
|
|
|
+ },
|
|
|
+ fail: (str) => {
|
|
|
+ console.log(str);
|
|
|
+ Message.warning(str);
|
|
|
+ sendPublishMessage({ type: 'estoppel-fail' });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
export function useDownloadSDK(fn, fnData) {
|
|
@@ -300,7 +322,7 @@ export function useDownloadSDK(fn, fnData) {
|
|
|
'https://class.csslcloud.net/static/dist/js/classMode.js',
|
|
|
'https://class.csslcloud.net/static/dist/js/classUpdateChat.js'
|
|
|
].forEach((item) => {
|
|
|
- document.querySelector(`script[src='${item}']`).remove();
|
|
|
+ document.querySelector(`script[src='${item}']`)?.remove();
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -310,7 +332,6 @@ export function useDownloadSDK(fn, fnData) {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-export let room_user_id = ref('');
|
|
|
export let roomInfo = ref({
|
|
|
room_id: '',
|
|
|
video_mode: 1,
|
|
@@ -323,10 +344,7 @@ export let roomInfo = ref({
|
|
|
});
|
|
|
export let student_list = ref([]); // 直播间学员列表
|
|
|
export let noStreamList = ref([]); // 无远程流学员列表
|
|
|
-export function useGroupInit(_downloadWebSDK) {
|
|
|
- const route = useRoute();
|
|
|
- let task_id = route.query.task_id;
|
|
|
-
|
|
|
+export function useGroupInit(_downloadWebSDK, task_id) {
|
|
|
GetLiveRoomInfo({ task_id }).then(
|
|
|
({ room_id, video_mode, task_name, cs_item_name, course_name, teacher_name, student_count, teacher_image_url }) => {
|
|
|
roomInfo.value = {
|
|
@@ -352,7 +370,10 @@ export function useGroupInit(_downloadWebSDK) {
|
|
|
audience_list: aList,
|
|
|
group_instance_mark: gMark
|
|
|
}) => {
|
|
|
- const data = sList.find((el) => el.is_self === 'true');
|
|
|
+ let data = sList.find((el) => el.is_self === 'true');
|
|
|
+ if (!data) {
|
|
|
+ data = aList.find((el) => el.is_self === 'true');
|
|
|
+ }
|
|
|
group_instance_mark.value = gMark;
|
|
|
session_id.value = data.session_id;
|
|
|
room_user_id.value = data.room_user_id;
|
|
@@ -360,7 +381,7 @@ export function useGroupInit(_downloadWebSDK) {
|
|
|
room_id.value = rId;
|
|
|
student_list.value = sList;
|
|
|
noStreamList.value = sList.filter((item) => item.is_self === 'false');
|
|
|
- studentSelf.value = sList.find((item) => item.is_self === 'true');
|
|
|
+ studentSelf.value = data;
|
|
|
audience_list.value = aList;
|
|
|
_downloadWebSDK();
|
|
|
}
|
|
@@ -405,10 +426,9 @@ export function useStudentGroup(audience) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- isAudience.value = is_audience === 'true';
|
|
|
- if (is_audience === 'true') {
|
|
|
+ if (is_audience === 'true' && !isAudience.value) {
|
|
|
+ isAudience.value = is_audience === 'true';
|
|
|
audience();
|
|
|
- // <!-- TODO -->
|
|
|
// router.push({
|
|
|
// path: '/live/student/audit',
|
|
|
// query: {
|
|
@@ -444,6 +464,7 @@ export function useStudentGroup(audience) {
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
clearInterval(timer);
|
|
|
+ closeVideo('picture');
|
|
|
StudentExitLiveRoom({ task_id, room_user_id: room_user_id.value });
|
|
|
});
|
|
|
|