You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.6 KiB
59 lines
1.6 KiB
|
|
<template>
|
|
<router-view></router-view>
|
|
<audio
|
|
class="audio"
|
|
src=""
|
|
@timeupdate="timeupdatefn"
|
|
style="display:none;"
|
|
></audio>
|
|
</template>
|
|
<script setup lang="ts">
|
|
// @ts-nocheck
|
|
import { useStore } from '@/store';
|
|
import { storeToRefs } from 'pinia';
|
|
import MqttUnit from "@/utils/mqttunit";
|
|
import { onMounted } from 'vue';
|
|
import {WebRtcStreamer} from '@/utils/webrtc-streamer/webrtcstreamer.js'
|
|
let pinia = useStore()
|
|
onMounted(() => {
|
|
let client = new MqttUnit().mqttInit();
|
|
let WebRtcStreamerRt=WebRtcStreamer()
|
|
if (typeof window !== 'undefined' && typeof window.document !== 'undefined') {
|
|
window.WebRtcStreamer = WebRtcStreamerRt;
|
|
}
|
|
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
|
module.exports = WebRtcStreamerRt;
|
|
}
|
|
client.on('message', (topic: string, message: Uint8Array) => {
|
|
const utf8decoder = new TextDecoder();
|
|
const msgString = utf8decoder.decode(message);
|
|
if (topic.startsWith("/server/warning")) {
|
|
// $mitt.emit("warnInfo", msgString);
|
|
console.log(msgString);
|
|
|
|
}
|
|
})
|
|
})
|
|
function timeupdatefn(e:any) {
|
|
let {audioCount,audioCurrentCount}=storeToRefs(pinia)
|
|
if (e.target.currentTime >= e.target.duration) {
|
|
let count_ = audioCurrentCount.value + 1;
|
|
pinia.updateaudioCurrentCount(count_)
|
|
if (audioCurrentCount.value < audioCount.value) {
|
|
e.target.currentTime = 0;
|
|
e.target.play();
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less">
|
|
body{
|
|
height: 100vh;
|
|
overflow: hidden;
|
|
user-select: none;
|
|
}
|
|
</style>
|
|
|