Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <div class="wrapper">
  <div class="audio-wrapper">
    <audio src="" controls class="js-audio audio"></audio>

  <div class="toolbar">
    <button class="js-start button button--start">Start</button>
    <button class="js-stop button button--stop">Stop</button>
              $white: #ffffff;
$grey: #E5E5E5;
$grey-dark: #B5B4B9;

$green: #6ABB5C;
$blue: #4FABE4;

body {
  background: $white;

.wrapper {
  padding: 2rem;

.audio-wrapper {
  margin: 0 0 2rem 0;

.audio {
  width: 100%;
  &::-webkit-media-controls-panel {
    background: white;

.toolbar {
  text-align: center

.button {
  transition: all .4s ease-in-out;
  position: inline-block;
  padding: .6rem 1rem;
  background: $white;
  border: 1px solid $grey;
  border-radius: 0;
  outline: none;
  text-transform: uppercase;
  color: $grey-dark;
  &--start:hover {
    background: $green;
    border-color: darken($green, 5);
    color: $white;
  &--stop:hover {
    background: $blue;
    border-color: darken($blue, 5);
    color: $white;

              // We'll save all chunks of audio in this array.
const chunks = [];

// We will set this to our MediaRecorder instance later.
let recorder = null;

// We'll save some html elements here once the page has loaded.
let audioElement = null;
let startButton = null;
let stopButton = null;

 * Save a new chunk of audio.
 * @param  {MediaRecorderEvent} event 
const saveChunkToRecording = (event) => {

 * Save the recording as a data-url.
 * @return {[type]}       [description]
const saveRecording = () => {
    const blob = new Blob(chunks, {
        type: 'audio/mp4; codecs=opus'
    const url = URL.createObjectURL(blob);

    audioElement.setAttribute('src', url);

 * Start recording.
const startRecording = () => {

 * Stop recording.
const stopRecording = () => {

// Wait until everything has loaded
(function() {
    audioElement = document.querySelector('.js-audio');
    startButton = document.querySelector('.js-start');
    stopButton = document.querySelector('.js-stop');
    // We'll get the user's audio input here.
        audio: true // We are only interested in the audio
    }).then(stream => {
        // Create a new MediaRecorder instance, and provide the audio-stream.
        recorder = new MediaRecorder(stream);

        // Set the recorder's eventhandlers
        recorder.ondataavailable = saveChunkToRecording;
        recorder.onstop = saveRecording;

    // Add event listeners to the start and stop button
    startButton.addEventListener('mouseup', startRecording);
    stopButton.addEventListener('mouseup', stopRecording);

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.