![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@mux/blurhash
Advanced tools
A server-side package for node that uses [woltapp/blurhash](https://github.com/woltapp/blurhash) and [sharp](https://www.npmjs.com/package/sharp) to make placeholders for Mux videos. Works nicely with [Mux Player](https://docs.mux.com/guides/video/mux-pla
A server-side package for node that uses woltapp/blurhash and sharp to make placeholders for Mux videos. Works nicely with Mux Player.
[!NOTE]
Since we wrote this library, we've learned a lot about blurry image placeholders on the web. While we would still encourage the use of facade placeholders and lazy-loading, using blurhash in the way this library promotes may not be the most efficient technique. We are working to update our documentation and examples.Check out Wes's blog post for the latest on this topic.
npm install @mux/blurhash
or
yarn add @mux/blurhash
Run @mux/blurhash
server-side. @mux/blurhash
will not work in the browser.
import muxBlurHash from '@mux/blurhash';
const playbackId = '3fevCt00ntwf7WxwvBhRo1EZ01IoABwo2d';
const { blurHash, blurHashBase64, sourceWidth, sourceHeight } = await muxBlurHash(playbackId);
blurHashBase64
with Mux Player<mux-player
placeholder="{blurHashBase64}"
style="aspect-ratio: {sourceWidth}/{sourceHeight}"
></mux-player>
<MuxPlayer placeholder={blurHashBase64} style={{ aspectRatio: sourceWidth / sourceHeight }} />
See the examples directory to learn more
blurHashBase64
with native elements<img src="{blurHashBase64}" width="{sourceWidth}" height="{sourceHeight}" />
background-image: url({blurHashBase64});
aspect-ratio: {sourceWidth}/{sourceHeight};
blurHash
with JavaScriptSee documentation for blurhash.decode
@mux/blurhash
will accept an optional second parameter that will allow configuration of the blurhash.
Parameter | Type | Description | Default |
---|---|---|---|
blurWidth | number | The image will be compressed to this width before blurring. Lower values load faster but have less detail. | 32 |
blurHeight | number | The image will be compressed to this height before blurring. Lower values load faster but have less detail. | 32 |
time | number | The video timestamp from which to grab the blurhash. (If you're using a thumbnailToken , then the time option will have no effect; encode time in your token according to the secure video playback guide linked below) | |
thumbnailToken | string | Videos with playback restrictions may require a thumbnail token. See https://docs.mux.com/guides/video/secure-video-playback for details |
import muxBlurHash from '@mux/blurhash';
// a lower resolution blurHash that will load more quickly
const options = { blurWidth: 16, blurHeight: 16 };
const { blurHash } = await muxBlurHash(playbackId, options);
FAQs
A server-side package for node that uses [woltapp/blurhash](https://github.com/woltapp/blurhash) and [sharp](https://www.npmjs.com/package/sharp) to make placeholders for Mux videos. Works nicely with [Mux Player](https://docs.mux.com/guides/video/mux-pla
The npm package @mux/blurhash receives a total of 0 weekly downloads. As such, @mux/blurhash popularity was classified as not popular.
We found that @mux/blurhash 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.