0.1.0-beta.2 • Published 2 years ago

@mux-elements/mux-uploader v0.1.0-beta.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Introduction

<mux-uploader></mux-uploader> is web component for uploading files to Mux.

mux-uploader-drop is an optional supporting web component for drop-in drag and drop and overlay. You can always configure your own drag and drop with mux-uploader.

If you are looking for a direct upload interface and a progress bar, you're in the right place.

Installation

If you're using npm or yarn, install that way:

Package manager

yarn add @mux-elements/mux-uploader

or

npm i @mux-elements/mux-uploader

Then, import the library into your application with either import or require:

import '@mux-elements/mux-uploader';

or

require('@mux-elements/mux-uploader');

CDN option

Alternatively, use the CDN hosted version of this package:

<script src="https://unpkg.com/@mux-elements/mux-uploader@0.1.0-beta.0"></script>

If you are using ECMAScript modules, you can also load the mux-uploader.mjs file with type=module:

<script type="module" src="https://unpkg.com/@mux-elements/mux-uploader@0.1.0-beta.0/dist/mux-uploader.mjs"></script>

Usage

<body>
  <p></p>

  <mux-uploader
    url="authenticated-url"
    id="uploader"
  ></mux-player>
</body>

Attributes

mux-uploader

AttributeTypeDescriptionDefault
urlstringThe authenticated URL that your file will be uploaded to. Check out the direct uploads docs for how to create one. Required.undefined
idstringAn ID that allows mux-uploader-drop to locate mux-uploader. Required.N/A
type"bar"Specifies the visual type of progress bar. A radial type is in-progress."bar"
upload-in-progressbooleanThe thumbnail token for signing the poster URL.false
upload-errorbooleanThe storyboard token for signing the storyboard URL.false
statusbooleanThis is an arbitrary title for your video that will be passed in as metadata into Mux Data. Adding a title will give you useful context in your Mux Data dashboard. (optional, but encouraged)false

mux-uploader-drop

AttributeTypeDescriptionDefault
fullscreenbooleanToggles fullscreen drag and drop (work-in-progress).false
overlaybooleanToggles fullscreen overlay on dragover.false
disable-dropbooleannToggles off drag and drop which is enabled by default.false

Methods

MethodDescription
handleUpload()Begins upload of the media.

Styling

mus-uploader can be styled with CSS variables.

Elements

  • <mux-uploader/>
NameCSS PropertyDefault ValueDescriptionNotes
--uploader-font-familyfont-familyArialfont family of the componentApplies to other elements as well: upload status and error status
--uploader-font-sizefont-size16pxfont size for text within the componentAlso applies to <mux-uploader-drop> i.e. overlay text
--uploader-background-colorbackground-colorinheritbackground color of area surrounding the upload
--button-background-colorbackground#fffbackground color of upload button
--button-border-radiusborder-radius4pxborder ardius of the upload button
--button-hover-textcolor#ffftext color of upload button on button hover
--button-hover-backgroundbackground#404040background color of upload button on button hover
--button-active-textcolor#fffcolor of upload button text when button is active
--button-active-backgroundbackground#000000background color of upload button when button is activeApplied via :active pseudo selector
--progress-bar-fill-colorbackground#000000background color for progress bar div
--progress-radial-fill-colorstrokeblackstroke color for circle SVG (wip)
  • <mux-uploader-drop/>
NameCSS PropertyDefault ValueDescriptionNotes
--overlay-background-colorbackground-colorrgba(226, 253, 255, 0.95)background color of the overlay divVisible only when component has fullscreen attribute