The audio element will not display / play inside the iframe in Firefox.

I have this HTML5 snippet that allows the user to click and play some sound:

<audio controls>
    <source src="cell.ogg">
    <source src="cell.mp3">
    <source src="cell.m4a">
</audio>

This works fine in FF 8 on OS X Lion. The audio player controls will appear, I can press the play button and it plays the ogg version.

But if I put the containing file inside the iframe of another HTML5 document (both from the local file system and due to problems with cross origin), then this will not work. The rest of the HTML is displayed fine, but Firefox acts as if it does not support any of the media formats.

Here is the function I use to add a page in an iframe:

function postContentToIframe(content)
{
    var iframe = $("#displayContents")[0].contentWindow.document;
    iframe.open(); iframe.close(); // must open and close document object to start using it!
    $("body", iframe).append(content).hide().fadeIn("slow");
    return;
}

Here is how FF does it.

enter image description here

Why? And how do I fix this? TIA.

+5
1

. / URL-. HTML ( iframe) HTML ( iframe) . , .

. () URL- URL-.

0

All Articles