Socket
Book a DemoInstallSign in
Socket

@mux/mux-uploader-astro

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mux/mux-uploader-astro

An open source Mux uploader for Astro that Just Works™

latest
Source
npmnpm
Version
1.3.0
Version published
Maintainers
1
Created
Source

<MuxUploader/>

Downloads Version License

Introduction

<MuxUploader /> is a Mux-flavored Astro uploader component, built on top of our mux-uploader web component.

Installation

npm install @mux/mux-uploader-astro

or

yarn add @mux/mux-uploader-astro

Usage

Basic Usage

---
import { MuxUploader } from '@mux/mux-uploader-astro';
---

<MuxUploader
  endpoint="https://my-authenticated-url/storage?your-url-params"
/>

Advanced Usage

---
import { MuxUploader } from '@mux/mux-uploader-astro';
---

<MuxUploader
  endpoint="https://my-authenticated-url/storage?your-url-params"
  pausable
  maxFileSize={1000000000}
  chunkSize={8192}
  style={{
    '--progress-bar-fill-color': '#7e22ce',
    '--button-background-color': '#f0f0f0',
  }}
/>

With Event Handling

To add event listeners to the component you can use a client-side script. You can get the correct types for the uploader element by importing MuxUploaderElement from @mux/mux-uploader-astro and casting the element to that type.

---
import { MuxUploader } from '@mux/mux-uploader-astro';
---

<MuxUploader
  id="my-uploader"
  endpoint="https://my-authenticated-url/storage?your-url-params"
  pausable
/>

<script>
  import type { MuxUploaderElement } from '@mux/mux-uploader-astro';

  const uploader = document.getElementById('my-uploader') as MuxUploaderElement;

  uploader.addEventListener('uploadstart', (event) => {
    console.log('Upload started!', event.detail);
  });

  uploader.addEventListener('success', (event) => {
    console.log('Upload successful!', event.detail);
  });

  uploader.addEventListener('uploaderror', (event) => {
    console.error('Upload error!', event.detail);
  });

  uploader.addEventListener('progress', (event) => {
    console.log('Upload progress: ', event.detail);
  });
</script>

Dynamic Endpoint

You can also set the endpoint dynamically:

---
import { MuxUploader } from '@mux/mux-uploader-astro';
---

<input type="text" id="endpoint-input" placeholder="Enter GCS URL..." />
<MuxUploader id="uploader" pausable />

<script>
  import type { MuxUploaderElement } from '@mux/mux-uploader-astro';

  const input = document.getElementById('endpoint-input') as HTMLInputElement;
  const uploader = document.getElementById('uploader') as MuxUploaderElement;

  input.addEventListener('change', () => {
    uploader.endpoint = input.value;
  });
</script>

Docs

Docs and guides live on docs.mux.com.

API reference lives on Github.

Keywords

video

FAQs

Package last updated on 09 Sep 2025

Did you know?

Socket

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.

Install

Related posts