Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
This library renders the graphical subtitles format PGS (.sup files) in the browser.
This project is still in progress. It should be able to play 99% of Blu-ray subtitles (Yes, I made that number up). But some rare used PGS features - like cropping - aren't implemented yet.
If you know a movie or show that is using the cropping feature, please let me know!
This library requires the following web features:
transferControlToOffscreen
isn't supported a fallback
is used where the subtitles are renderer on the main thread.Install the package via npm:
npm i --save libpgs
The PGS renderer will create a default canvas element next to the video element:
const videoElement = document.getElementById('video-element');
const pgsRenderer = new libpgs.PgsRenderer({
// Make sure your bundler keeps this file accessible from the web!
workerUrl: './node_modules/libpgs/dist/libpgs.worker.js',
video: videoElement,
subUrl: './subtitle.sup'
});
The created default canvas element is using a style definition like this:
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
width: '100%';
height: '100%';
pointer-events: 'none';
object-fit: 'contain';
This only works if the video element is stretched in its parent and if the parent is using the css position
property.
<div style="position: relative">
<video id="video-element" src="./video.mp4"></video>
</div>
It is also possible to provide a custom canvas element and position it manually:
const videoElement = document.getElementById('video-element');
const canvasElement = document.getElementById('canvas-element');
const pgsRenderer = new libpgs.PgsRenderer({
// Make sure your bundler keeps this file accessible from the web!
workerUrl: './node_modules/libpgs/dist/libpgs.worker.js',
video: videoElement,
canvas: canvasElement,
subUrl: './subtitle.sup'
});
You can also adjust time offset between video and subtitle:
// Rendering the subtitle 3 seconds in advance of the video
pgsRenderer.timeOffset = 3.0;
Make sure to dispose the renderer when leaving:
// Releases video events and removes the default canvas element
pgsRenderer.dispose();
FAQs
Renderer for graphical subtitles (PGS) in the browser.
The npm package libpgs receives a total of 1,493 weekly downloads. As such, libpgs popularity was classified as popular.
We found that libpgs 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.