NetStream onMetaData – IE7 Focus Bug
9th July, 2007 – 7:14 pmCame across a weird bug when working with Flash’s NetStream media playback object and Internet Explorer 7. I’m still not 100% sure what the problem is here, but it would appear that when Internet Explorer doesn’t have focus (ie, you are working in another window), the NetStream object in flash doesn’t always fire its onMetaData() method. Excessive load (CPU) can also help bring on this problem. Read on to see the ActionScript source code I am using and the temporary solution I have found.
First off, I will flesh out the basic mediaPlayback class so that we are all singing from the same hymn sheet:
Applying some logic to the above example, we would first load a new FLV file into our object using the loadFLV() method. This would start the FLV caching in the user’s browser ready for us to fire the play() method a few seconds later (ie: after a displaying a thumbnail image for x seconds).
Now the problem is that the ns.pause() seems to foul up the onMetaData() listener. In Firefox (and in Flash’s own Publish player) the onMetaData event gets fired and our duration is set correctly. However, in IE7, when the window does not have focus, this does not happen.
My only work around was to remove the whole “caching” element from my object, and the startPlayback() method simply causes an ns.play(flvURL) to fire (in which case the MetaData gets set correctly).
Anyone out there got a bullet proof way to start caching a FLV file before playback without having to use the ns.play(); ns.pause() combo?
J.
2 Responses to “NetStream onMetaData – IE7 Focus Bug”
Hi J,
I’m not sure I follow – how are you doing it in action script? Can you post some examples?
I currently am working on a flash video player and use that exact approach:
ns.play(url);
ns.pause(true);
ns.seek(0);
but Win2K IE6 and WinXP IE7 both have problem: when I close the popup browser window and click on the same or similar link, the ns doesn’t seem to start playback… and in fact IE can no longer visit the domain (url) it was streaming the video from in the first place…
Strange.
Regards,
– Leo
By Leo on Aug 16, 2007
Yes, it is wierd and it sounds like the exact same problem that I was experiencing, Leo. To be honest, I gave up on “pre-loading” the FLV file in the end and just went with a simple:
function play() {
if (!started) {
ns.play(url);
} else {
ns.play();
}
Which is bullet proof and works 100% of the time – just doesn’t allow for cacheing. :(
By Jonny on Aug 18, 2007