0

I want to embed a music as the background music into my blog and let it auto play. I thought it could be easy, just type the html code.

I have a music hosted on One Drive and I inserted 3 pieces of code into my blog like below:

<iframe src="https://onedrive.live.com/embed?cid=xxxxx&resid=xxx&authkey=xxxxxx" allow="autoplay" width="98" height="120" frameborder="0" scrolling="no"></iframe>

<audio controls="" autoplay="" loop="">
    <source src="https://onedrive.live.com/embed?cid=xxxxx&resid=xxxxx&authkey=xxxxx&autoplay=1" type=”audio/mp3″>
</audio>

<embed id="background-audio" src="https://onedrive.live.com/embed?cid=xxxxx&amp;resid=xxxxx&amp;authkey=xxxxx" autostart="1">

audio

iframe and embed tags look same, they look like the music icon on the right side of the screen shot; audio tag looks like the one on the left side, but disabled.

Could anyone show me how to do it?


Update 1

This is what the Backend looks like: enter image description here

Franva
  • 6,565
  • 23
  • 79
  • 144
  • Just to clarify: are you simply asking how to autoplay an audio in JavaScript? [Does this help](https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide)? – Robin Métral May 24 '20 at 17:23
  • @RobinMétral nope, I know how to do it with JavaScript but I need to make it happen with Gatsby + NetlifyCMS at the backend when writing Blog. I will add a screenshot to demo what I mean. – Franva May 25 '20 at 05:53

0 Answers0