Commit ad034036 authored by Alain Takoudjou's avatar Alain Takoudjou

Cleanup and make code compliant with ts

parent 4270cd0e
...@@ -1194,7 +1194,6 @@ function updateControlStatus(id, isLocal, shared, audioMode, muted) { ...@@ -1194,7 +1194,6 @@ function updateControlStatus(id, isLocal, shared, audioMode, muted) {
* @param {string} peerid * @param {string} peerid
*/ */
function registerControlEvent(peerid) { function registerControlEvent(peerid) {
let settings = getSettings();
let peer = document.getElementById(peerid); let peer = document.getElementById(peerid);
//Add event listener when a video component is added to the DOM //Add event listener when a video component is added to the DOM
let volume = /** @type {HTMLElement} */(peer.querySelector("span.volume")); let volume = /** @type {HTMLElement} */(peer.querySelector("span.volume"));
...@@ -1245,24 +1244,30 @@ function registerControlEvent(peerid) { ...@@ -1245,24 +1244,30 @@ function registerControlEvent(peerid) {
}; };
} }
let media = /** @type {HTMLElement} */(peer.querySelector("video.media")); let media = /** @type {HTMLVideoElement} */(peer.querySelector("video.media"));
/** @ts-ignore */
if(media.onenterpictureinpicture && media.onleavepictureinpicture) {
/** @ts-ignore */
media.onenterpictureinpicture = function(event) { media.onenterpictureinpicture = function(event) {
if(event.target.classList.contains('media-static')) if(event.target.classList.contains('media-static'))
return; return;
event.target.classList.remove('media-mirror'); event.target.classList.remove('media-mirror');
}; };
/** @ts-ignore */
media.onleavepictureinpicture = function(event) { media.onleavepictureinpicture = function(event) {
if(event.target.classList.contains('media-static')) if(event.target.classList.contains('media-static'))
return; return;
event.target.classList.add('media-mirror'); event.target.classList.add('media-mirror');
}; };
}
let stop = /** @type {HTMLElement} */(peer.querySelector(".stopsharing")); let stop = /** @type {HTMLElement} */(peer.querySelector(".stopsharing"));
if (stop) { if (stop) {
stop.onclick = function(event) { stop.onclick = function(event) {
event.preventDefault(); event.preventDefault();
let video = getParentVideo(event.target); let element = /** @type {HTMLElement} */(event.target);
let video = getParentVideo(element);
let video_id = video.id.split("-")[1]; let video_id = video.id.split("-")[1];
for(let id in serverConnection.up) { for(let id in serverConnection.up) {
if (video_id === id) { if (video_id === id) {
......
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