Socket
Socket
Sign inDemoInstall

cordova-plugin-iosrtc

Package Overview
Dependencies
17
Maintainers
3
Versions
61
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.20 to 6.0.21

4

CHANGELOG.md

@@ -0,1 +1,5 @@

#### Version 6.0.21
* fix Canvas drawImage memory leak fix #681
* fix Warning [LayoutConstraints] Unable to simultaneously satisfy constraints.
#### Version 6.0.20

@@ -2,0 +6,0 @@ * fix Remove extmap-allow-mixed sdp header on RTCPeerConnection.prototype.setRemoteDescription to handle chrome 89

72

js/iosrtc.js

@@ -223,19 +223,59 @@ /**

var drawImage = CanvasRenderingContext2D.prototype.drawImage;
CanvasRenderingContext2D.prototype.drawImage = function (arg) {
var args = Array.prototype.slice.call(arguments);
var context = this;
if (arg instanceof HTMLVideoElement && arg.render) {
arg.render.save(function (data) {
var img = new window.Image();
img.addEventListener('load', function () {
args.splice(0, 1, img);
drawImage.apply(context, args);
img.src = null;
CanvasRenderingContext2D.prototype.drawImage = (function () {
// Methods to address the memory leaks problems in Safari
let temporaryImage, imageElement;
const BASE64_MARKER = ';base64,';
const objectURL = window.URL || window.webkitURL;
function convertDataURIToBlob(dataURI) {
// Validate input data
if (!dataURI) {
return;
}
// Convert image (in base64) to binary data
const base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
const base64 = dataURI.substring(base64Index);
const raw = window.atob(base64);
const rawLength = raw.length;
let array = new Uint8Array(new ArrayBuffer(rawLength));
for (let i = 0; i < rawLength; i++) {
array[i] = raw.charCodeAt(i);
}
// Create and return a new blob object using binary data
return new Blob([array], { type: 'image/jpeg' });
}
return function (arg) {
const context = this;
let args = Array.prototype.slice.call(arguments);
if (arg instanceof HTMLVideoElement && arg.render) {
arg.render.save(function (base64Image) {
// Destroy old image
if (temporaryImage) {
objectURL.revokeObjectURL(temporaryImage);
}
// Create a new image from binary data
const imageDataBlob = convertDataURIToBlob('data:image/jpg;base64,' + base64Image);
// Create a new object URL object
imageElement = imageElement || new Image();
temporaryImage = objectURL.createObjectURL(imageDataBlob);
imageElement.addEventListener('load', function () {
args.splice(0, 1, imageElement);
drawImage.apply(context, args);
});
// Set the new image
imageElement.src = temporaryImage;
});
img.setAttribute('src', 'data:image/jpg;base64,' + data);
});
} else {
return drawImage.apply(context, args);
}
};
} else {
return drawImage.apply(context, args);
}
};
})();
}

@@ -242,0 +282,0 @@

{
"name": "cordova-plugin-iosrtc",
"version": "6.0.20",
"version": "6.0.21",
"description": "Cordova iOS plugin exposing the full WebRTC W3C JavaScript APIs",

@@ -5,0 +5,0 @@ "author": "Iñaki Baz Castillo (https://inakibaz.me)",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc