InteractiveAdvertisingBureau / SIMID

Secure Interactive Media Interface Definition (SIMID)
https://interactiveadvertisingbureau.github.io/SIMID/
Apache License 2.0
46 stars 25 forks source link

Creative Example: simid_player.js file: createSimidIframe_() - creating the iframe in a different element seems to enable intended functionality #309

Open ftslo opened 4 years ago

ftslo commented 4 years ago

I assume the intended functionality of the creative example is to enable the user to toggle between the overlay and survey ad types, then click 'initialize the creative' and 'Start ad playback' to switch between SIMID creatives. If this is the case, it think modifying the line of code below may enable this functionality.. I'm not certain if this is the correct place to make this change, but I thought I'd mention it here.

 createSimidIframe_() {
    // const playerDiv = document.getElementById('ad_video_div');    // This element seems to be where the frame should go; Putting it here also allows you to toggle between 'overlay' and 'survey' ad types then initiating and starting the ad without having to reload the page.

    const playerDiv = document.getElementById('player_div');  // current element
    const simidIframe = document.createElement('iframe');
    simidIframe.style.display = 'none';
    // The target of the player to send messages to is the newly
    // created iframe.
    playerDiv.appendChild(simidIframe);
    // Set up css to overlay the SIMID iframe over the video creative.
    simidIframe.classList.add('simid_creative');
    // Set the iframe creative, this should be an html creative.
...
    return simidIframe;
  }