Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

videojs-wavesurfer

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

videojs-wavesurfer

video.js plugin that adds a navigable waveform for audio and video files.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Video.js Wavesurfer

A video.js plugin that adds a navigable waveform for audio and video files, using the wavesurfer.js library. Includes support for fullscreen mode and real-time visualization of microphone input.

Screenshot

npm version npm License Build Status

Installation

You can use bower (bower install videojs-wavesurfer) or npm (npm install videojs-wavesurfer) to install the plugin, or download it elsewhere.

Since v1.0 this plugin is compatible with video.js 5.0 and newer. If you want to use this plugin with an older video.js 4.x version, check the archived releases for a 0.9.x release or earlier.

Using the Plugin

The plugin depends on the wavesurfer.js and video.js packages:

<link href="//vjs.zencdn.net/5.0/video-js.css" rel="stylesheet">

<script src="//katspaugh.github.io/wavesurfer.js/dist/wavesurfer.min.js"></script>
<script src="//vjs.zencdn.net/5.0/video.js"></script>

The plugin automatically registers itself when you include videojs.wavesurfer.js on your page:

<script src="videojs.wavesurfer.js"></script>

Add an audio element:

<audio id="myClip" class="video-js vjs-default-skin"></audio>

Or video element:

<video id="myClip" class="video-js vjs-default-skin"></video>

Plugin Options

Configure the player using the video.js options, and enable the plugin by adding a wavesurfer entry with the related wavesurfer.js options:

var player = videojs("myClip",
{
    controls: true,
    autoplay: true,
    loop: false,
    width: 600,
    height: 300,
    plugins: {
        wavesurfer: {
            src: "media/heres_johnny.wav",
            msDisplayMax: 10,
            waveColor: "grey",
            progressColor: "black",
            cursorColor: "black",
            hideScrollbar: true
        }
    }
});

See the full audio example (demo or source) and the video example (demo or source).

The additional options for this plugin are:

optiontypedefaultdescription
srcstringnullThe URL of the audio/video file or 'live' when using the microphone plugin.
msDisplayMaxfloat3Indicates the number of seconds that is considered the boundary value for displaying milliseconds in the time controls. An audio clip with a total length of 2 seconds and a msDisplayMax of 3 will use the format M:SS:MMM. Clips with a duration that is longer than msDisplayMax will be displayed as M:SS or HH:MM:SS.

Customizing controls

If you want to disable and hide specific controls, use the video.js children option:

children: {
    controlBar: {
        children: {
            // hide fullscreen control
            fullscreenToggle: false
        }
    }
},

Microphone plugin

It's also possible to use a microphone for real-time rendering of the audio waveform. This uses the microphone plugin that comes with wavesurfer.js.

Include the additional wavesurfer.microphone.js plugin on your page:

<script src="//katspaugh.github.io/wavesurfer.js/dist/plugin/wavesurfer.microphone.min.js"></script>

Add an audio element:

<audio id="myLiveAudio" class="video-js vjs-default-skin"></audio>

Configure the player: use the value 'live' for the src option:

var player = videojs("myLiveAudio",
{
    controls: true,
    width: 600,
    height: 300,
    plugins: {
        wavesurfer: {
            src: "live",
            waveColor: "black",
            cursorWidth: 0,
            interact: false
        }
    }
});

See the full live example (demo or source).

More features using other plugins

The Video.js community created lots of plugins that can be used to enhance the player's functionality. Plugins actually tested with videojs-wavesurfer:

  • videojs-record - Adds support for recording audio/video files.
  • videojs-persistvolume - Saves user's volume setting using localStorage, but falls back to cookies if necessary.

Contributing

Install grunt-cli:

sudo npm install -g grunt-cli

Install dependencies using npm:

npm install

Or using bower:

bower install

Build a minified version:

grunt

Generated files are placed in the dist directory.

License

This work is licensed under the MIT License.

Keywords

FAQs

Package last updated on 12 Oct 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc