const body = document.createElement('body')
const root = document.createElement('div')
document.title = "Strapp.io Client"
-body.appendChild(root)
-document.body = body
const conf = {"iceServers": [{ "urls": "stun:stun.1.google.com:19302" }] }
let dataChannel
/* Start data channel */
dataChannel = cpc.createDataChannel("sendChannel");
dataChannel.onmessage = (msg) => {
- console.log(msg.data)
+ /* Get mediaStream from host and add it to the video */
+ let video = document.querySelector('')
}
dataChannel.onopen = () => {
dataChannel.send(`Hi from the Client`)
+ document.write('<button> Connection with host established! </button> <video autoplay id="screenOutput"></video>')
}
})
+document.addEventListener('DOMContentLoaded', () => {
+
+ document.body.innerHTML = `<button> Setting up connection with host </button>`
+
+});
document.title = "Strapp.io Host"
+
+
const conf = {"iceServers": [{ "urls": "stun:stun.1.google.com:19302" }] }
const clients = new Map([])
const iceCandidates = []
}
}
}
+ document.body.innerHTML = '<div>Choose options for client</div> <video autoplay></video>'
+
+ navigator.mediaDevices.getUserMedia({ video : { mediaSource: "screen", // whole screen sharing
+ // mediaSource: "window", // choose a window to share
+ // mediaSource: "application", // choose a window to share
+ width: {max: '1920'},
+ height: {max: '1080'},
+ frameRate: {max: '10'}} })
+ .then(function(mediaStream) {
+ let video = document.querySelector('video')
+ video.srcObject = mediaStream
+ video.onloadedmetadata = function(e) {
+ video.play()
+ }
+ })
+ .catch(function(err) { console.log(err); }); // always check for errors at the end.
})
}
else {
<link rel=icon href="./www/favicon-96x96.png">
<!--STRAPP_MANIFEST-->
<link rel=manifest href="./www/manifest.json">
- <script type="text/plain" href="https://rawgit.com/PeculiarVentures/webcrypto-liner/master/dist/webcrypto-liner.shim.js"></script>
+ <script type="text/plain" src="https://rawgit.com/PeculiarVentures/webcrypto-liner/master/dist/webcrypto-liner.shim.js"></script>
+ <script type="text/javascript" src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<script type="text/javascript">
<!--STRAPP_SRC-->
</script>