ARTICLE AD BOX
I'm trying to show trailers in a webapp, it's working fine for normal browsers, as well as android apps. However, when I package the javascript in my tizen app, it fails to show the embedded video, it just plays the sound. There are other weird things too, like a button not completely updating either.
I have tried multiple different courses of action, but AI seem unable to figure out the issue.
Here is the relevant code where the embedded video is injected:
const { trailer, streamUrl } = localData; const iframe = document.createElement('iframe'); iframe.className = 'local-trailer-frame'; iframe.allow = 'autoplay'; iframe.style.border = '0'; iframe.srcdoc = ` <style>body{margin:0;background:#000;overflow:hidden;}video{width:100%;height:100%;object-fit:cover;}</style> <video id="v" autoplay src="${streamUrl}"></video> <script> const v=document.getElementById('v'); v.volume=${globalVolume}; v.onended = () => parent.postMessage('local-trailer-ended', '*'); window.addEventListener('message', e => { if(e.data==='toggle') v.paused?v.play():v.pause(); }); <\/script>`; videoContainer.appendChild(iframe); localTrailerIframe = iframe; clickOverlay.onclick = () => iframe.contentWindow.postMessage('toggle', '*');