Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
videostream
Advanced tools
Streams data from a file-like seekable object into a `video` or `audio` node (a HTMLMediaElement)
Streams data from a file-like seekable object into a <video> or <audio> node (a HTMLMediaElement
).
Seeking the media element will request a different byte range from the incoming
file-like object.
For now only mp4 files are supported. The goal is to support most files that conform to ISO/IEC 14496-12.
Version 2 is completely rewritten and substantially more robust than the previous version that relied on mp4box.js. The only major regression compared to the previous architecture is that fragmented mp4 files aren't supported. If this is a problem I may add support again at some point.
Support for most other formats will take significant work.
Videostream just exports a function. Use it like this:
const exampleFile = {
createReadStream: function (opts) {
const start = opts.start;
const end = opts.end;
// Return a readable stream that provides the bytes
// between offsets "start" and "end" inclusive
}
}
const VideoStream = require('videostream');
const elem = document.createElement('video');
const videostream = VideoStream(exampleFile, elem);
elem.addEventListener('error', () => {
// listen for errors on the video/audio element directly
const errorCode = elem.error
const detailedError = videostream.detailedError
// videostream.detailedError will often have a more detailed error message
})
Handle errors by listening to the 'error'
event on the <video>
or <audio>
tag.
Some (but not all) errors will also cause videostream.detailedError
to be set to
an error value that has a more informative error message.
MIT. Copyright (c) John Hiesey.
FAQs
Streams data from a file-like seekable object into a `video` or `audio` node (a HTMLMediaElement)
We found that videostream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.