Embedded media fails to load w/ Webkit

I have an Iframe used to embed media on dynamic pages. The code works perfectly on firefox every time, but works only the first time on Webkit browsers. After that, the iframe shows up completely empty.

Initially it was sometimes failing to load at all, but I figured out that adding a timer to the dataset’s .onReady got rid of that problem, so I assumed the issue is in how webkit loads the dataset. However, when I use developertools to see what’s going on, refreshing the webpage while inspecting the iframe forces it to load just fine, which makes me think it’s a communication error between the iframe and the browser…

Anyone have any ideas as to why this could be happening? Would greatly appreciate a solution or workaround as I’ve been struggling with this for a while now.

HTML Component code:

<iframe id='videoFrame'
		scrolling="no"
		frameborder="0"
		border="0"
    src="#"
    width="560"
    height="315">
</iframe>
<script>
window.onmessage = (message) => {
  document.getElementById('videoFrame').src = message.data
}
</script>

Page JS code:

import wixLocation from 'wix-location';
import wixData from 'wix-data';
import wixWindow from "wix-window"

let debounceTimer

$w.onReady(function () {
 if (wixWindow.rendering.env === 'browser') {
        $w("#dynamicDataset").onReady(() => {
 if ($w('#embedURL').text.length > 0) {
 if (debounceTimer) {
                    clearTimeout(debounceTimer);
                    debounceTimer = undefined;
                }
                debounceTimer = setTimeout(() => {
                    $w('#embedOne').postMessage($w('#dynamicDataset').getCurrentItem().mediaEmbed);
                    $w('#mediaHolder').expand();
                }, 200);
            } 
        } );
    }
} );

Is it possible to get the browser type in WixCode? I’ve tried using standard JS but it didn’t work and the feature isn’t listed in the API.

Also, would be great if anyone has tips on preventing the iframe’s scrollbars as it’s loading!

Bumping, I need an answer on this!