Dynamic media not loading videos when an external script is used in the page | Community
Skip to main content
jezwn
Level 5
August 12, 2021
Question

Dynamic media not loading videos when an external script is used in the page

  • August 12, 2021
  • 1 reply
  • 794 views

I've this dynamic media component in page. When I try to add a video to it, it remains blank(Refer screenshot below, I've dropped a video to the dynamic media, but it's not visible in the UI, but the data is getting added to the nodes properly).

 

 

But when I instead add an image to it, it's working fine.


 

No errors observed in either browser console/sling logs.

I did some debugging around this and found one external script was causing the issue. It was a Usersnap script which adds a feedback button to the page.

 

window.onUsersnapLoad = function(api) { api.init(); } var script = document.createElement('script'); script.defer = 1; script.src='https://api.usersnap.com/load/YOUR-API-KEY.js?onload=onUsersnapLoad'; document.getElementsByTagName('head')[0].appendChild(script);

 

 

 

The dynamic media started functioning normal when this script was removed from the page. But was not able to figure out why this is happening. Could someone help me with this? Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Asutosh_Jena_
Community Advisor
Community Advisor
August 19, 2021

Hi @jezwn 

 

Can you load the script on the <head> section of your page component and see if it resolves the issue. I feel like the issue is with the defer tag and it's not allowing to render the content.

 

Thanks!