mirror of
https://github.com/jech/galene.git
synced 2024-11-23 00:55:58 +01:00
Call revokeObjectURL in the onclose callback.
This avoids special-casing file streams.
This commit is contained in:
parent
371289793b
commit
e7d7c2dd0a
1 changed files with 10 additions and 10 deletions
|
@ -911,6 +911,15 @@ async function addFileMedia(file) {
|
||||||
let c = newUpStream();
|
let c = newUpStream();
|
||||||
c.kind = 'video';
|
c.kind = 'video';
|
||||||
c.stream = stream;
|
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) {
|
stream.onaddtrack = function(e) {
|
||||||
let t = e.track;
|
let t = e.track;
|
||||||
if(t.kind === 'audio') {
|
if(t.kind === 'audio') {
|
||||||
|
@ -972,12 +981,8 @@ function stopUpMedia(c) {
|
||||||
*/
|
*/
|
||||||
function delUpMedia(c) {
|
function delUpMedia(c) {
|
||||||
stopUpMedia(c);
|
stopUpMedia(c);
|
||||||
try {
|
|
||||||
delMedia(c.id);
|
|
||||||
} catch(e) {
|
|
||||||
console.warn(e);
|
|
||||||
}
|
|
||||||
c.close();
|
c.close();
|
||||||
|
delMedia(c.id);
|
||||||
delete(serverConnection.up[c.id]);
|
delete(serverConnection.up[c.id]);
|
||||||
setButtonsVisibility();
|
setButtonsVisibility();
|
||||||
}
|
}
|
||||||
|
@ -1261,11 +1266,6 @@ function delMedia(id) {
|
||||||
let media = /** @type{HTMLVideoElement} */
|
let media = /** @type{HTMLVideoElement} */
|
||||||
(document.getElementById('media-' + id));
|
(document.getElementById('media-' + id));
|
||||||
|
|
||||||
if(media.src) {
|
|
||||||
URL.revokeObjectURL(media.src);
|
|
||||||
media.src = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
media.srcObject = null;
|
media.srcObject = null;
|
||||||
mediadiv.removeChild(peer);
|
mediadiv.removeChild(peer);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue