Skip to content

Commit

Permalink
feat: 支持房间短id自动转换
Browse files Browse the repository at this point in the history
  • Loading branch information
orangelckc committed Jan 27, 2023
1 parent 7bfd0aa commit 17e6c1f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/views/Robot/message/robot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,17 @@ export const startWebsocket = async () => {
Notify.create("请输入主播名称和机器人名称");
return;
}
connected.value = true;
emit(EVENTS.OPEN_WEBSOCKET_EVENT, { roomid: manage.roomid });
// 获取直播间信息
const { by_room_ids } = await getLiveStatusApi(manage.roomid);
const roomid = Object.keys(by_room_ids)[0];
if (!roomid) {
Notify.create("直播间不存在");
return;
}
emit(EVENTS.OPEN_WEBSOCKET_EVENT, { roomid });
once(EVENTS.CONNECT_SUCCESS_EVENT, (event) => {
console.log("ws连接成功");
Notify.create("直播间连接成功");
connected.value = true;
init_listener();
});
init_listener();
};
8 changes: 7 additions & 1 deletion src/views/Robot/room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ import { message } from "@tauri-apps/api/dialog";
import { open } from "@tauri-apps/api/shell";
import { Stream } from '@/types'
import { Notify } from "quasar";
const streams = ref<Stream[]>([]);
const isRecording = ref(false)
const getUrl = async () => {
if (!manage.roomid.trim()) return
const { by_room_ids } = await getLiveStatusApi(manage.roomid);
const { live_status, uname, title } = by_room_ids[manage.roomid];
const roomid = Object.keys(by_room_ids)[0];
if (!roomid) {
Notify.create("直播间不存在");
return;
}
const { live_status, uname, title } = by_room_ids[roomid];
if (live_status !== 1) {
message(`${uname}直播间未开播!`)
return false
Expand Down

0 comments on commit 17e6c1f

Please sign in to comment.