Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


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


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.


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.


                <div id="sdnPlayer"></div>

<script src="//"></script>



                body {
  margin: 0 auto;
  max-width: 50rem;
  background: #eee;


                const dataId_main = '66e68995-11ca-11e8-9273-002590c750be'
const dataId_second = '1bc8cbdc-73c5-11e8-ae4b-0cc47a188158'

let player

// Main method to set up the player
const loadPlayer = (dataId) => {
  // Destroy the existing player
  if (player && typeof player.destroy === 'function') {
  // Initialize the player
  player  = new js3q({
    container: 'sdnPlayer',
    dataid: dataId,
    controlBarAutoHide: false,
  player.on('media.ready', () => {
    // Set the dataid to the opposite of the current
    const nextDataId = dataId === dataId_main ? dataId_second : dataId_main

// Create the Button and attach it to the ControlBar
function attachButton(dataid) {
  // If there is already a button, skip
  if (document.getElementById('sdnPlayer-switch-button')) return

  // Define the button
  const switchBtnEl = document.createElement('js3q-button')
  switchBtnEl.setAttribute('id', 'sdnPlayer-switch-button')
  switchBtnEl.setAttribute('class', 'sdn-button-right sdnicbsun-chat')
  switchBtnEl.setAttribute('tooltip', 'Switch language')
  switchBtnEl.addEventListener('click', () => loadPlayer(dataid))

  // Attach the button to the control bar
  const controlbarEl = document.getElementById('sdnPlayer-chrome')

// Initial Call