Commit 6a9ab969 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Use default controls for streamed video.

parent 58ba37d8
...@@ -892,6 +892,7 @@ async function addFileMedia(file) { ...@@ -892,6 +892,7 @@ async function addFileMedia(file) {
let url = URL.createObjectURL(file); let url = URL.createObjectURL(file);
let video = document.createElement('video'); let video = document.createElement('video');
video.src = url; video.src = url;
video.controls = true;
/** @ts-ignore */ /** @ts-ignore */
let stream = video.captureStream(); let stream = video.captureStream();
...@@ -1042,6 +1043,7 @@ function setMedia(c, isUp, video) { ...@@ -1042,6 +1043,7 @@ function setMedia(c, isUp, video) {
div.appendChild(label); div.appendChild(label);
} }
if(!video) {
let template = document.getElementById('videocontrols-template') let template = document.getElementById('videocontrols-template')
.firstElementChild; .firstElementChild;
let top_template = document.getElementById('top-videocontrols-template') let top_template = document.getElementById('top-videocontrols-template')
...@@ -1076,8 +1078,8 @@ function setMedia(c, isUp, video) { ...@@ -1076,8 +1078,8 @@ function setMedia(c, isUp, video) {
camera.remove(); camera.remove();
} }
if(!video)
media.srcObject = c.stream; media.srcObject = c.stream;
}
setLabel(c); setLabel(c);
setMediaStatus(c); setMediaStatus(c);
...@@ -1142,6 +1144,7 @@ function registerControlEvent(peerid) { ...@@ -1142,6 +1144,7 @@ function registerControlEvent(peerid) {
} }
let pip = /** @type {HTMLElement} */(peer.querySelector("span.pip")); let pip = /** @type {HTMLElement} */(peer.querySelector("span.pip"));
if(pip) {
/** @ts-ignore */ /** @ts-ignore */
if(HTMLVideoElement.prototype.requestPictureInPicture) { if(HTMLVideoElement.prototype.requestPictureInPicture) {
pip.onclick = function(event) { pip.onclick = function(event) {
...@@ -1153,8 +1156,10 @@ function registerControlEvent(peerid) { ...@@ -1153,8 +1156,10 @@ function registerControlEvent(peerid) {
} else { } else {
pip.style.display = 'none'; pip.style.display = 'none';
} }
}
let fs = /** @type {HTMLElement} */(peer.querySelector("span.fullscreen")); let fs = /** @type {HTMLElement} */(peer.querySelector("span.fullscreen"));
if(fs) {
fs.onclick = function(event) { fs.onclick = function(event) {
event.preventDefault(); event.preventDefault();
let fs = /** @type {HTMLElement} */(event.target); let fs = /** @type {HTMLElement} */(event.target);
...@@ -1165,6 +1170,7 @@ function registerControlEvent(peerid) { ...@@ -1165,6 +1170,7 @@ function registerControlEvent(peerid) {
displayWarning("Video Fullscreen not supported!"); displayWarning("Video Fullscreen not supported!");
} }
}; };
}
let camera = /** @type {HTMLElement} */(peer.querySelector("span.camera")); let camera = /** @type {HTMLElement} */(peer.querySelector("span.camera"));
if(camera) { if(camera) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment