1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-23 00:55:58 +01:00

Use default controls for streamed video.

This commit is contained in:
Juliusz Chroboczek 2020-11-24 23:05:43 +01:00
parent 58ba37d8da
commit 6a9ab96902

View 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) {
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) {
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) {
} }
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) {
} 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) {
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) {