npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-mirt

v1.3.5

Published

An iOS inspired audio trimmer component for React

Downloads

194

Readme

react-mirt

An react audio trimmer component ~copied~ inspired by iOS. It can be used to set a start and end time for an audio file in order to process it further, e.g. using ffmpeg. You can also zoom in to make finer adjustments by holding down the handle.

ezgif-1-bfe867f0ff

Install

  yarn add react-mirt
  # npm install react-mirt

Use

import Mirt from 'react-mirt';
import 'react-mirt/dist/css/react-mirt.css';

function App() {
  return <Mirt file={myWayTooLongAudioFile} />;
}

Props

| Property | Type | Description | | :---------- | :------- | :------------------------------------- | | file | File | The audio file to be trimmed | | className | string | Additional classes on the root element | | style | object | Additional styles on the root element | | options | object | See options below |

Options

| Parameter | Type | Default | Description | | :------------------- | :-------- | :----------------------- | :------------------------------------------------------------------------------------------- | | showButton | boolean | true | Show/hide the play button | | waveformColor | string | rgba(255, 255, 255, 0.5) | Color of the waveform as CSS color value | | waveformBarWidth | number | 0.5 | Width of waveform bar depending on the block width (e.g. 0.5 equals half of the block width) | | waveformBlockWidth | number | 4 | Width of waveform block (sum of bar and space) | | waveformLoading | boolean | false | Animate waveform until actual waveform is loaded | | fineTuningDelay | number | 500 | Delay (ms) for switching to fine tuning (0 disables fine tuning) | | fineTuningScale | number | 5 | Zoom factor for fine tuning | | start | number | | Overwrite current start value | | end | number | | Overwrite current end value |

Callback functions

| Event | Type | Description | | :----------------- | :----------------------------------------------------------- | :------------------------------------------------------------------------------------------------- | | onChange | ({ start: number; current: number; end: number }) => void; | Returns the start and end values and the current playhead handle position, if one of these changed | | onAudioLoaded | (audio: HTMLAudioElement) => void; | Triggered as soon as the audio element has been loaded, returns the HTML audio element | | onWaveformLoaded | () => void; | Triggered as soon as the waveform has been generated | | onError | (error: Error) => void; | Triggered when an error has occurred, returns the error |

Styling

There are several ways to customise the appearance. I recommend overwriting the CSS variables. But you can also import the sass file and overwrite its variables or you add your own styles on top.

| Variable | Sass Variable | Default | Description | | :---------------------------------- | :---------------------------- | :------ | :-------------------------------------------------- | | --mirt-height | $height | 3rem | Height of the component | | --mirt-border-radius | $border-radius | 0.3rem | Border radius of component and inner frame | | --mirt-background-color | $background-color | #333 | Background color (also of button and waveform) | | --mirt-playhead-width | $playhead-width | 0.35rem | Playhead width | | --mirt-playhead-color | $playhead-color | #fff | Playhead color | | --mirt-frame-border-width | $frame-border-width | 0.3rem | Width of (colored) frame border | | --mirt-frame-color | $frame-color | #409f80 | Color of frame | | --mirt-handle-width | $handle-width | 1.2rem | Width of start and end handles | | --mirt-handle-icon-width | $handle-icon-width | 0.75rem | Icon width of start and end handles | | --mirt-handle-icon-color | $handle-icon-color | #333 | Icon color of start and end handles | | --mirt-handle-transition-duration | $handle-transition-duration | 500ms | Transition duration start, end and playhead handles | | --mirt-button-width | $button-width | 3rem | Width of play/pause button | | --mirt-button-border-color | $button-border-color | #222 | Border (right) color of play/pause button | | --mirt-button-hover-color | $button-hover-color | #444 | Hover color of play/pause button | | --mirt-button-icon-width | $button-icon-width | 1rem | Icon width of play/pause button | | --mirt-button-icon-color | $button-icon-color | #fff | Icon color of play/pause button |

License

MIT