Pen Settings

HTML

CSS

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

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <main class="has-background-dark">
  <div class="is-family-sans-serif  has-text-white has-text-centered">
  <h1 class="is-size-1 has-text-centered is-uppercase has-text-weight-bold">Sound check!</h1>
  <p class="">See if your microphone and headphones are setup properly</p>
  <p> For the Microphone test, a prompt will appear asking for permission to access your select output device </p>
    <p>If you are not using headphones, it'll have a loop feedback</p>
    <p></p>
  <button class="button is-primary is-fullwidth is-large" id="micTest" type="button">Test Microphone</button>
  
  <button class="button is-link is-light is-fullwidth is-medium" id="soundTest" type="button">Test Headphone/Speakers</button>
    </div>
</main>
              
            
!

CSS

              
                // Nothing here is related with the bare bone of the project

#micTest::before {
  content: '';
  background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CgogPGc+CiAgPHRpdGxlPmJhY2tncm91bmQ8L3RpdGxlPgogIDxyZWN0IGZpbGw9Im5vbmUiIGlkPSJjYW52YXNfYmFja2dyb3VuZCIgaGVpZ2h0PSI0MDIiIHdpZHRoPSI1ODIiIHk9Ii0xIiB4PSItMSIvPgogPC9nPgogPGc+CiAgPHRpdGxlPkxheWVyIDE8L3RpdGxlPgogIDxwYXRoIGZpbGw9IiNmZmZmZmYiIGlkPSJzdmdfMiIgZD0ibTEyLDE2YzIuMjA2LDAgNCwtMS43OTUgNCwtNGwwLC02YzAsLTIuMjA2IC0xLjc5NCwtNCAtNCwtNHMtNCwxLjc5NCAtNCw0bDAsNmMwLDIuMjA1IDEuNzk0LDQgNCw0eiIvPgogIDxwYXRoIGZpbGw9IiNmZmZmZmYiIGlkPSJzdmdfMyIgZD0ibTE5LDEybDAsLTJjMCwtMC41NTIgLTAuNDQ3LC0xIC0xLC0xcy0xLDAuNDQ4IC0xLDFsMCwyYzAsMi43NTcgLTIuMjQzLDUgLTUsNXMtNSwtMi4yNDMgLTUsLTVsMCwtMmMwLC0wLjU1MiAtMC40NDcsLTEgLTEsLTFzLTEsMC40NDggLTEsMWwwLDJjMCwzLjUyIDIuNjEzLDYuNDMyIDYsNi45MmwwLDEuMDhsLTMsMGMtMC41NTMsMCAtMSwwLjQ0NyAtMSwxczAuNDQ3LDEgMSwxbDgsMGMwLjU1MywwIDEsLTAuNDQ3IDEsLTFzLTAuNDQ3LC0xIC0xLC0xbC0zLDBsMCwtMS4wOGMzLjM4NywtMC40ODggNiwtMy40IDYsLTYuOTJ6Ii8+CiA8L2c+Cjwvc3ZnPg==");
  background-size: contain;
  display: block;
  width: 20px;
  height: 20px;
}

#soundTest::before {
  content: '';
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgoKIDxnPgogIDx0aXRsZT5iYWNrZ3JvdW5kPC90aXRsZT4KICA8cmVjdCBmaWxsPSJub25lIiBpZD0iY2FudmFzX2JhY2tncm91bmQiIGhlaWdodD0iNDAyIiB3aWR0aD0iNTgyIiB5PSItMSIgeD0iLTEiLz4K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ksLTIzLjEgNjEuNCwtNDAuOSA5Ni4xLC01My4zYzM2LC0xMi45IDczLjgsLTE5LjIgMTEyLjMsLTE5LjJsMC4xLDBjMzksMCA3Ny4yLDYuNCAxMTMuNSwxOS41YzM1LjEsMTIuNyA2Ny43LDMxIDk2LjksNTQuNmwtMzcuNSw0Ni43eiIvPgogPC9nPgo8L3N2Zz4=");
  background-size: contain;
  display: block;
  width: 20px;
  height: 20px;
}

main {
  display: flex;
  height: 100vh;
  width: 100vw;
  align-items: center;
  justify-content: center;
  
  div {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 300px;
  }
}
              
            
!

JS

              
                // Based On https://github.com/webrtc/samples/tree/gh-pages/src/content/getusermedia/audio

function handleSuccess(stream) {
  if (window.stream) {
    window.stream.getAudioTracks().forEach(track => track.stop());
    window.stream = null;
  } else {
    const audio = document.createElement('audio');
    audio.controls = true;
    audio.autoplay = true;
    window.stream = stream;
    audio.srcObject = stream;

    stream.oninactive = function() {
      console.log('Stream ended');
    };
  }
}

function handleError(e){
  console.log("ruin", e.message);
}

document.querySelector("#micTest").addEventListener('click', function(){
  if ( window.stream ) {
    this.innerText = "Test Microphone";
  } else {
    this.innerText = "Stop Test";
  }
  if (navigator.mediaDevices) {
    const constraints = window.constraints = {
      audio: true, 
      video: false
    }
    navigator.mediaDevices.getUserMedia(constraints).then(handleSuccess).catch(handleError)
  }
});

document.querySelector('#soundTest').addEventListener('click', function(){
    const audio = document.createElement('audio');
    audio.controls = true;
    audio.autoplay = true;
    audio.src = 'https://teste-sdk-rs.s3.amazonaws.com/Purr.wav';
})
              
            
!
999px

Console