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.


Auto Save

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.


                <h1>PES advanced custom Header Bidding implementation</h1>

<!-- <script src="prebid.js"></script> -->

<!-- Step 1: Enable the Player config to use 'enable_wait_for_custom_config' via REST API -->

<!-- Step 2: Embed a Player with the associated Player ID. (you can alternatively use the dailymotion.createPlayer() to create the player dynamically) -->
  data-video="x8jdywp" id="myPlayer"

to check if the custom config has been set:<br /><br />
> inspect Network tab > filter vmap, click Play button & check Response tab of the call<br />
>>> ccHb* should be in the payload<br />
<br /><br />





 * fake asynchronous bid request function
 * to be implemented by partners
 * @param {Object} state - the player state (retrieved by AD_READYTOFETCH)
 * @return {Promise}
 * @resolve {Object} computed customConfig object
 * @reject {String} error
const myFetchPrebid = async ({ videoId, adPosition } = {}) => {
  const timeout = (ms) => new Promise(resolve => setTimeout(resolve, ms))

  await timeout(2000)

  return {
    hbTest: 'customHBwithPES',
    hbVideoId: videoId || 'tooEarly',
    hbAdPosition: adPosition || 'preroll',

// Step 3: get the player and fetch advertising values from the header bidding solution in parallel
// When used with a first preroll, myFetchPrebid function shouldn't trigger a prebid auction since it is already ongoing. It should however trigger the auction for any other ad break than first preroll
Promise.all([dailymotion.getPlayer('myPlayer'), myFetchPrebid()])
  .then(([player, customConfig]) => {
    // Step 4: When ad values returned and the player is retrieved, update the player with setCustomConfig()

    // Step 5: Add an event listener AD_READYTOFETCH for the next ads
    // each time the event is caught, fetch new advertising values and pass it via setCustomConfig() 
    player.on(, (state) => {
        .then((customConfig) => {
        .catch((err) => {
  .catch(() => {
    console.error("fail to get the player")