hey,
i have a swf which calls a javascript function to display a div (that looks like a little window) and replace the div’s contents with embed code that users can grad from youtube or google video.
this part works fine. the div is displayed above my swf with the youtube video inside.
the div looks like a little window with a drag bar and a close button.
the problem is that when a user tries to close the little div window in safari, the youtube video (i’m assuming it’s the same for other flash content), continues playing it’s audio. the audio is stopped (as it should be) in firefox.
the way the div is “closed” is by first setting the contents of the div to “”, ie empty string. so the object/embed code is gone. but in safari this is apparently not enough to unload the flash player.
below you can see the javascript which sets the contents of the DIV to be that of the embed video, the function which hides the embedded video, and the div itself.
<script type="text/javascript">
<!--
function hide_embed(){
change_content( "" );
var vid = document.getElementById("vid_pane");
vid.style.display = "none";
}
function change_content( shtml ){
var id = "vid_content";
if (document.getElementById || document.all) {
var el = document.getElementById? document.getElementById(id): document.all[id];
if (el && typeof el.innerHTML != "undefined") el.innerHTML = shtml;
}
}
// -->
</script>
<div id="vid_content">
<!-- this will be replaced with video embed code -->
</div>
thanks for checking it out…