javascript - Muting audio source from within an html iframe possibly using JS -
i working on gallery page quite few external html pages embedded using iframe, however, of these external pages have audio embedded them mute.
here sample code html files
gallery.html
<div id="pages"> <iframe id="embed" src="https://xyz.com/page1.html"></iframe> <iframe id="embed" src="https://sdf.com/page2.html"></iframe> </div> page1.html
<html> <head> <!-- head stuff--> </head> <body> <audio autoplay> <source src="http://audio.url/somefile.ogg" type="audio/ogg"> <source src="http://audio.url/somefile.mp3" type="audio/mpeg"> browser not support audio tag. </audio> <!--some more body content> <body> </html> also, since i'm dealing multiple external pages, audio tags might not have ids attached them. makes document.getelementbyid() non-reliable option. i've experimented document.getelementsbytagname("input") couldn't quite audio muted. can please me this?
since these pages being served different domains not able access html within iframe due same origin policy.
Comments
Post a Comment