"Quick" browser plug-in question


Hi Jules,

I’ve been seeing some problems when reloading webpage with my browser plug-in (when within a div). Mac FF/Safari, fwiw. I’m not at all clear what is going on, but I’d guess the issue is related somehow to the old plug-in not being fully released by the browser until the new plug-in is fully loaded (just a hunch, not at all clear yet what is going on!).

My quick question :slight_smile: is this: do you think there’d be any issues with having two instances of the same juce-based browser plug-in loaded at the same time by the same browser…?

Best wishes,



Yes, I think in safari you’ve got to expect it to overlap two plugin instances like that when it’s reloading.

in theory of course, there can be any number of instances open, and you’ve got to make sure your code can handle that!


Thanks Jules,

Hmm… I seem to be having problems under Firefox, the code can crash in the Juce audio drivers on the Mac side for reasons I can’t fathom out; Windows under Windows also can crash when reloading a page but I’m not sure why. Safari shows different problems, but IE on Windows seems OK. :slight_smile:

Never mind, I’m sure I’ll figure it out eventually…!



If you’re using audio, I’d recommend using a device manager object that’s shared between the instances, probably reference counted. Or a singleton.


Hi Jules,

Now then - you’ve really grabbed my attention with that comment. :slight_smile:

Why do you recommend that…?

Best wishes,



It’s just a lot more efficient to open the device once, and share it amongst your plugins, especially when instances might be coming and going quickly, as in safari.


Ah, right, I see…!

Dumb question time: does this mean that multiple instances of the same plug-in are all basically just references counts of the same shared library all loaded under the one browser process? I hadn’t really thought about it before, but I guess from your comment that must be the case…

FWIW, under IE things seem to behave differently, so I wonder if IE keeps the ActiveX controls safely partitioned from each other…?



Yes, there’s only one module loaded, same as audio plugins.

IE7 is pretty hardcore - in “protected mode” it sandboxes the plugins into their own process. Whether it loads each instance separately I’ve no idea.


Interesting stuff. Thanks Jules. :slight_smile:


For what it is worth, on Mac the problem I have is that in juce::CoreAudioInternal::start, the call to AudioDeviceAddIOProc fails (error code 503).

This happens if there is already an active playing audio session.

Looks like I’m going to have to modify my code to guard against this, it doesn’t look like I’m going to able to have multiple instances of the same browser plug-in accessing audio at the same time. Looks like I need to do something creative like reference counting as you suggested. :slight_smile:

Best wishes,