replaced iframe with share screen

This commit is contained in:
Ben Arc
2021-04-20 13:41:59 +01:00
parent 02a406d0fa
commit 92722b315b
2 changed files with 17 additions and 31 deletions

View File

@@ -1,12 +1,11 @@
{% extends "public.html" %} {% block page %}<q-page> {% extends "public.html" %} {% block page %}<q-page>
<iframe <div
width="100%" width="100%"
height="100%" height="100%"
id="iframe_main" id="iframe_main"
src="/" src="/"
class="fixed-bottom-left" class="fixed-bottom-left"
> ></div>
</iframe>
<video <video
autoplay="true" autoplay="true"
id="videoElement" id="videoElement"
@@ -247,12 +246,22 @@
} }
if (res[1] == 'true') { if (res[1] == 'true') {
document.getElementById('videoElement').style.width = '20%' document.getElementById('videoElement').style.width = '20%'
async function startCapture(displayMediaOptions) {
let captureStream = null
try {
captureStream = await navigator.mediaDevices.getDisplayMedia(
displayMediaOptions
)
} catch (err) {
console.error('Error: ' + err)
}
document.getElementById('iframe_main').src = captureStream
}
} }
if (res[1] == 'false') { if (res[1] == 'false') {
document.getElementById('videoElement').style.width = '100%' document.getElementById('videoElement').style.width = '100%'
} document.getElementById('iframe_main').src = null
if (res[1].substring(0, 3) == 'htt') {
document.getElementById('iframe_main').src = res[1]
} }
console.log(res[2]) console.log(res[2])
if (res[2] != 'none') { if (res[2] != 'none') {

View File

@@ -24,35 +24,12 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<q-btn <q-btn
disable
class="q-mt-sm q-ml-sm" class="q-mt-sm q-ml-sm"
color="primary" color="primary"
@click="fullscreenToggle" @click="fullscreenToggle"
label="Webcam size" label="Screen share"
> >
<q-tooltip> Coming soon </q-tooltip></q-btn </q-btn>
>
</div>
<div class="col">
<q-input
disable
class="q-pt-sm"
dense
outlined
bottom-slots
v-model="iframe"
label="iframe url"
><q-tooltip> Coming soon </q-tooltip>
<template v-slot:after>
<q-btn
round
dense
flat
@click="iframeChange(iframe)"
icon="send"
/>
</template>
</q-input>
</div> </div>
</div> </div>
<div class="row q-pa-sm"> <div class="row q-pa-sm">