hey,
i have 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 the window (another fullscreen div containing a fullscreen 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. it continues with the audio, and if the video “window” is reopened, both layers of audio will play.
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. hide_embed is the function that is meant to trash the window with the youtube video.
<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>
i had mistakenly put this in the flash forum, but realized with no actionscript involved i might not get any help there… thanks and peace