|
|
@@ -12,20 +12,25 @@ const ScreenShare = { |
|
|
|
isOn: false, |
|
|
|
start() { |
|
|
|
const screen = document.querySelector('video.screen') |
|
|
|
navigator.mediaDevices.getDisplayMedia() |
|
|
|
if(screen) { |
|
|
|
navigator.mediaDevices.getDisplayMedia() |
|
|
|
.then(s => {screen.srcObject = s}) |
|
|
|
.catch(e => console.error(e)) |
|
|
|
} |
|
|
|
}, |
|
|
|
toggle() { |
|
|
|
ScreenShare.isOn = !ScreenShare.isOn |
|
|
|
// ScreenShare.start() |
|
|
|
if(ScreenShare.isOn) { |
|
|
|
// setTimeout(ScreenShare.start, 100) |
|
|
|
} |
|
|
|
}, |
|
|
|
view() { |
|
|
|
const style = { |
|
|
|
width: '80%', |
|
|
|
height: '80%', |
|
|
|
overflow: 'scroll', |
|
|
|
} |
|
|
|
return m('video.screen[playsinline][autoplay]', {style}) |
|
|
|
return ScreenShare.isOn && m('div', {style}, |
|
|
|
m('video.screen[playsinline][autoplay]'), |
|
|
|
) |
|
|
|
}, |
|
|
|
} |
|
|
|
addEventListener('load', () => { |