Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@fix-webm-duration/fix
Advanced tools
navigator.mediaDevices.getUserMedia + MediaRecorder create WEBM files without duration metadata. This library appends missing metadata section right to the file blob.
navigator.mediaDevices.getUserMedia
+ MediaRecorder
create WEBM files without duration metadata.
This library appends missing metadata section right to the file blob.
Install from a package manager:
npm install @fix-webm-duration/fix
Then, the library could be imported:
import { fixWebmDuration } from "@fix-webm-duration/fix";
Syntax:
const newBlob = await fixWebmDuration(blob, duration, options = {});
where
blob
is Blob
object with file contents from MediaRecorder
duration
is video duration in milliseconds (you should calculate it while recording the video)options
is an object of options:
options.logger
- a callback for logging debug messages or false
.
The callback should accept one argument - the message string.
By default, console.debug
will be used for logging.
Passing false
will disable the logging.fixWebmDuration
will parse and fix your file asynchronously and return the fixed blob once the result is ready.
If the original blob already contains duration metadata section and the duration value is not empty, the callback will receive it without any changes made.
Example:
let mediaRecorder;
let mediaParts;
let startTime;
function startRecording(stream: MediaStream, options: MediaRecorderOptions) {
mediaParts = [];
mediaRecorder = new MediaRecorder(stream, options);
mediaRecorder.onstop = async () => {
const duration = Date.now() - startTime;
const buggyBlob = new Blob(mediaParts, { type: "video/webm" });
const fixedBlob = await fixWebmDuration(buggyBlob, duration)
displayResult(fixedBlob);
};
mediaRecorder.ondataavailable = (event) => {
var data = event.data;
if (data && data.size > 0) {
mediaParts.push(data);
}
};
mediaRecorder.start();
startTime = Date.now();
}
function stopRecording() {
mediaRecorder.stop();
}
function displayResult(blob: Blob) {
// ...
}
Note: this example is not a MediaRecorder
usage guide.
FAQs
navigator.mediaDevices.getUserMedia + MediaRecorder create WEBM files without duration metadata. This library appends missing metadata section right to the file blob.
The npm package @fix-webm-duration/fix receives a total of 7,326 weekly downloads. As such, @fix-webm-duration/fix popularity was classified as popular.
We found that @fix-webm-duration/fix demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.