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

Call revokeObjectURL in the onclose callback.

This avoids special-casing file streams.
This commit is contained in:
Juliusz Chroboczek 2021-01-12 02:23:52 +01:00
parent 371289793b
commit e7d7c2dd0a

View file

@ -911,6 +911,15 @@ async function addFileMedia(file) {
let c = newUpStream();
c.kind = 'video';
c.stream = stream;
c.onclose = function() {
let media = /** @type{HTMLVideoElement} */
(document.getElementById('media-' + this.id));
if(media && media.src) {
URL.revokeObjectURL(media.src);
media.src = null;
}
}
stream.onaddtrack = function(e) {
let t = e.track;
if(t.kind === 'audio') {
@ -972,12 +981,8 @@ function stopUpMedia(c) {
*/
function delUpMedia(c) {
stopUpMedia(c);
try {
delMedia(c.id);
} catch(e) {
console.warn(e);
}
c.close();
delMedia(c.id);
delete(serverConnection.up[c.id]);
setButtonsVisibility();
}
@ -1261,11 +1266,6 @@ function delMedia(id) {
let media = /** @type{HTMLVideoElement} */
(document.getElementById('media-' + id));
if(media.src) {
URL.revokeObjectURL(media.src);
media.src = null;
}
media.srcObject = null;
mediadiv.removeChild(peer);