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 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…?
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.
Never mind, I’m sure I’ll figure it out eventually…!
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.
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…?
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.