Socket
Socket
Sign inDemoInstall

opentok-camera-filters

Package Overview
Dependencies
233
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 1.3.1

2

package.json
{
"name": "opentok-camera-filters",
"version": "1.3.0",
"version": "1.3.1",
"description": "Streaming from a Canvas with Filters to an OpenTok Session",

@@ -5,0 +5,0 @@ "main": "src/filter.js",

@@ -16,4 +16,5 @@ [![Build Status](https://travis-ci.org/aullman/opentok-camera-filters.svg?branch=master)](https://travis-ci.org/aullman/opentok-camera-filters)

* Firefox 49+
* Safari 11+
These filters require the Canvas [captureStream API](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/captureStream) which works in Chrome 51+ and Firefox 43+. Adding audio to the stream only started working in Firefox 49+.
These filters require the Canvas [captureStream API](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/captureStream) which works in Chrome 51+, Firefox 43+ and Safari 11+ (and Safari on iOS 11). Adding audio to the stream only started working in Firefox 49+.

@@ -20,0 +21,0 @@ # Usage

@@ -9,5 +9,24 @@ const mockGetUserMedia = require('./mock-get-user-media');

let initialFilter;
let exports;
// Mock out getUserMedia and replace the stream with the canvas.captureStream()
const cleanupOriginalStream = () => {
if (exports && exports.originalStream) {
if (global.MediaStreamTrack && global.MediaStreamTrack.prototype.stop) {
// Newer spec
exports.originalStream.getTracks().forEach((track) => { track.stop(); });
} else {
// Older spec
exports.originalStream.stop();
}
exports.originalStream = null;
}
};
// Mock out getUserMedia and replace the original stream with the canvas.captureStream()
mockGetUserMedia(stream => {
cleanupOriginalStream();
if (exports) {
exports.originalStream = stream;
}
videoElement = document.createElement('video');

@@ -46,3 +65,4 @@ videoElement.srcObject = stream;

}
return {
exports = {
setPublisher: publisher => {

@@ -71,2 +91,3 @@ // We insert the canvas into the publisher element. captureStream() only works

}
cleanupOriginalStream();
});

@@ -81,2 +102,4 @@ },

};
return exports;
};

@@ -24,6 +24,8 @@ /* global describe it expect OT beforeAll SESSION_ID TOKEN API_KEY jasmine spyOn */

it('stops drawing frames when the publisher is destroyed', done => {
it('stops drawing frames and stops the stream when the publisher is destroyed', done => {
spyOn(window, 'requestAnimationFrame').and.callThrough();
const publisher = OT.initPublisher(err => {
expect(err).toBeFalsy();
const originalStream = filter.originalStream;
expect(originalStream).toBeDefined();
publisher.on('destroyed', () => {

@@ -33,2 +35,6 @@ // Check that filterTask isn't still being called after we destroyed the publisher

expect(callCount).toBeGreaterThan(0);
// Check that the original stream was stopped
originalStream.getTracks().forEach(track => {
expect(track.readyState).toEqual('ended');
});
setTimeout(() => {

@@ -35,0 +41,0 @@ expect(window.requestAnimationFrame.calls.count()).toBe(callCount);

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