[RESOLVED] stopping a video that is playing in a hidden div
Hi folks!
I seem to have coded myself into a corner, and I’m hoping you can help me out.
On a product demo page, I have set up popup video modals based on hidden divs. Everything works great….except…
In IE (all versions as far as I can tell)
When the video window is closed (div hidden), the video keeps playing. This does not happen in any other browser.
From the research I managed, and this does not appear to be a unique problem.
However, there doesn’t seem to be a good solution.
Some people are editing the flash video action script (which we do ~not~ have access to, unfortunately)
There seems to be some javascript that only ½ works.
HTML Code:
<script type="text/javascript">
function resetVideo(divId) {
if (typeof(divId)=="string") { divId=document.getElementById(divId); }
if (divId.innerHTML) {
org=divId.innerHTML;
divId.innerHTML='';
divId.innerHTML=org;
}
return false;
}
</script>
I have implemented it on a test video. It stops the video playing when the window is closed, but when the user clicks the video a second time, it won’t play at all.
The only alternative I can see, is to make a "new window" pop up for each video (which is not what the designers wanted)
I’m stumped. at this point I'm coding in circles. Any suggestions you have will be most welcome. If I’m going in completely the wrong direction, let me know. Can you think of any other option to make this work?
I would imagine your best bet would be to use SWFobject to create your videos on the fly, and then basically remove them from the DOM when you want to make them stop. That way they remain in memory.
Another option, and I'm not sure why you're not using this, is to use HighSlide. It's as simple as installing the script and then using a link with a special onclick event to launch the video. See a YouTube example at waitspace.com/Entertainment/Reception-Area-Waiting-Room-Video-And-Trivia-Entertainment-s/172.htm (sorry if that violates posting policies).
Also, if you've already coded everything and don't want to switch, but you're using YouTube videos, you can enable allowScriptAccess="always" and use yourVideoObject.stopVideo()
Bookmarks