Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
get-test-media
Advanced tools
Generate a dummy MediaStream instance. This is useful for testing purposes where a media stream from getUserMedia
is expected (e.g. in a RTCPeerConnection
). This only works in modern browsers that support the Canvas.captureStream
method.
npm install get-test-media
See the live demo.
The exported function accepts an options object somewhat similar to getUserMedia
constraints (see example). It's also possible to pass a canvas
element which will be used for drawing. Otherwise an element is created, attached to the body and hidden outside the screen by using absolute positioning.
var getTestMedia = require('get-test-media');
// Check if the browser supports the required APIs.
if(!getTestMedia.supported) console.error('Not supported');
var media = getTestMedia({
audio: true,
video: {
width: 400,
height: 300,
frameRate: 24
}
});
var pc = new RTCPeerConnection();
pc.addStream(media.stream);
// Cleanup when the stream is no longer in use.
media.close();
The object returned from getTestMedia
has two properties. The stream
property contains the MediaStream instance, while the close
method cleans up the underlying resources and should be called when the stream is no longer in use.
FAQs
Generate a dummy MediaStream
The npm package get-test-media receives a total of 14 weekly downloads. As such, get-test-media popularity was classified as not popular.
We found that get-test-media demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.