稍后再做

This commit is contained in:
TonyChyi 2022-09-27 17:23:49 +08:00
parent de24203100
commit 24ae8d7657
2 changed files with 24 additions and 1 deletions

3
TODO Normal file
View File

@ -0,0 +1,3 @@
1. 视频分辨率切换问题
2. 还是没声音
3. 综合调试

View File

@ -2,7 +2,7 @@
<div>
<canvas id="vnc" />
<div id="data">
<video id="video" muted autoplay />
<video id="video" muted autoplay controls="none" />
<audio id="audio" autoplay />
</div>
</div>
@ -66,6 +66,7 @@ onMounted(() => {
props.methods.resetVM = resetVM;
const video = document.querySelector("canvas#vnc");
video.oncontextmenu = () => false;
store.getICEServers().then((servers) => {
const pc = new RTCPeerConnection({
@ -99,6 +100,13 @@ onMounted(() => {
el.controls = false;
el.oncontextmenu = () => false;
document.getElementById("data").appendChild(el);
if (el.track.kind === "video") {
const ctx = video.getContext("2d");
setTimeout(() => {
ctx.drawImage(this.video, 0, 0);
}, 0);
}
};
dataChannel.onopen = () => {
@ -156,6 +164,7 @@ onMounted(() => {
</script>
<style scoped>
/*
video#video {
vertical-align: middle;
top: 50%;
@ -165,4 +174,15 @@ video#video {
max-height: 100%;
max-width: 100%;
}
*/
canvas#vnc {
vertical-align: middle;
top: 50%;
transform: translateY(-50%) translateX(-50%);
left: 50%;
position: absolute;
max-height: 100%;
max-width: 100%;
}
</style>