Is there a way to influence automatic sound settings in Flash / AS3? - actionscript-3

I am creating a voice enabled application in Flash using RTMFP and I noticed that the Flash plugin automatically regulates down the sound volume of other processes/applications (at least on Windows) as soon as a RTMFP stream is opened and starts playing - very similar to the way Skype does this. Furthermore it seems that Flash also regulates itself (!) down in volume as soon as the Microphone is accessed what is quite contraproductive in group conferences. See: http://i50.tinypic.com/2415r4k.jpg
So, what I am trying to do is to get access to the automatic sound settings, either to disable or to set my own rules for them because the defaults don't work out very well in my oppinion. Unfortunately, searching on this topic did not raise any usable results so I hope that maybe someone else has managed to do this already and is able to give me a hint.
If this is not possible in general it would still be sufficient to disable automatic sound settings on every NetStream opened so that at least these are always at 100% volume or more, depending on the case. Does anyone know if manually setting the volume/gain on a NetStream instance overrides the automatic settings made by the plugin? Or is the automatic sound setting always overriding that/adding to that settings and entirely out of a developer's influence?
Thanks in advance

It's more of a Windows 7 problem and not directly related to Flash. You can change this behavior if you check your settings in the Control Panel: Sound - Communications - "When Windows detects communications activity".
There is no workaround from the Flash point of view, as the operating system itself controls this volume adjustment. If you use SoundTransform(1) on your NetStream, the Flash Player outputs the full volume, but the Windows sound manager is one level above and turns it down again.

Related

Chrome's Flash player Shared Objects and External Flash Player Shared Objects

I am working on an AS3 application. I need to store some data locally (on user's machine). I used Shared Object concept. Now in chrome, the default flash player (pepper flash) stores the shared object in a different folder. So if a user changes from the default flash player to externally installed flash player and vice versa (by disabling/enabling flash player from plugins) there will be loss of data. Let me simplify. External flash player stores shared object at 'A' and pepper flash at 'B'. If I switch the flash players, i will miss the data at 'A'/'B'. How can I solve this problem? Is there a way to retrieve the data? Please help me.
Because the Flash plugin itself controls where shared objects are stored and you cannot (as far as I am aware) change that location nor determine what that location is, there is nothing you can do about this one, unfortunately. You will have to deal with the lost data. It will happen eventually anyway, because I believe shared objects are cleared when you clear temporary browser data (or at least they should be, anyway).
On the bright side, the average user does not know you can switch between plugins nor do they know how. The vast majority of Chrome users, even those with a more technical background, will be using the terrible Pepper Flash plugin, so your scenario should be a rarity.
There is a way around it, however. You could set up a remote server and store the shared object there. That way it is not stored locally and you decide where it is actually stored. I personally can't think of a situation where this would be preferable to having a couple users lose their data, but it might fix things for you.

How to Check Adobe AIR applications performance ?Any tools?

Hi I'm creating an adobe AIR application..Its working fine ,But I want to make my application without performance issues..How to Check Adobe AIR applications performance ?Is there any tools available?
Take a look at Adobe Scout
"Adobe Scout is the next-generation profiling tool for Adobe Flash Player and AIR."
When building any flash application you define the application FPS. If the real FPS (flash can skip frames under high load) is lower than the defined FPS- you have troubles. You can check the FPS by vast variety of FPS meters here.
If your real FPS coinsides with the defined one - it is great, but try rising the defined FPS value up to 120 (which is max) and check out the real value, it is hardly be higher than 60 during animations, but the higher you can get - the better your application is. With this approach you can eliminate or at least point out "slow code".
ADD: It also worth mentioning that if the defined FPS value is 24, and the application is in stable state (the amount of animation, animation complexity and computational complexity stay more or less the same) the real value will "float" across some value, let's say 23 FPS with the spread of 1-2 (i.e. 22.7, 23.5, 23.9, 23.1, etc). And the mean value will be always lower than the defined FPS value.
Try to check memory usage. I would start trying to launch Flash Builder profiler remotely while your app is running live on the device and check out memory utilization. Refer this
Try to check redraw regions. Note that MovieClips that are not visible (e.g. throbbers) are still redrawing unless the are stopped. So if you see some region redraws without sencible reason - try to figure out why. The ideal case is to call stop() and visible=false or remove from stage the unused animations.
ADD: Redraw regions indicator is a part of Debug version of Flash Player. You can enable it through the context menu of the debug version of Flash Player.
UPDATE: I added some details to my answer as I see the interest to the Adobe Flash Perfomance issue. I don't remember the exact acticle, but I found a lot of usefull advices on the Abode's site, now I see that the number of such articles there increased.
Also I didn't know about the Adobe Scout before, but it sounds promising. I'll definately try it soon.

In AS3 how can you detect if someone pulls their camera out of the USB port?

In AS3 if the SWF gets a hold of someone's camera successfully and they start streaming video across and everything, but then mid-stream, either they accidentally wiggle their camera out of the USB port, or the camera just sort of breaks down, or something else like that, how could you detect it from that user's side? I've tried using event listeners and also polling different variables every five seconds, but neither has worked; none of the public properties of Camera or its events seem to act funny at all when something like that happens. And apparently you can't just keep scanning the computer for devices (for good reason, I guess).
Is there something I'm missing here? Is there a way to detect from a user's copy of a SWF (FP or AIR, but much more importantly FP) when their camera has effectively stopped as the result of something going wrong, such as them wiggling it out of the computer by mistake? If so how? Thanks!
While you may have difficulty in detecting when the camera/microphone stops working or is deactivated, you can discern that something has gone wrong if you are publishing the video/audio to a server with a NetStream.
The NetStream has an info property which is a NetStreamInfo object. It will give you both a running total of bytes as well as a rate of bytes/second of data that the NetStream is sending to the server.
Running totals: byteCount, audioByteCount, videoByteCount
current rate in bytes/second: currentBytesPerSecond, audioBytesPerSecond, videoBytesPerSecond
If you use the running totals, you need to periodically check the byteCount and calculate your own rate. Or you can let Flash Player do all the work and use the rates that it's calculating. In the case of recording, these values give you an indication of how much data the NetStream is receiving from the camera/microphone (and going to send to the server).
We found that we could reliably determine on the client that something had gone wrong when the rate fell below 5 kilobits/second. We used the same threshold and similar calculations on an FMS server (w/custom server side Actionscript) as well.
I don't recall a proper "get camera status" call you can make on demand but you can try listening for the status event and hope there's one fired on disconnect.
If you haven't already done so, on you 5 second check try: if(myCameraObject == null) assuming var myCameraObject = Camera.GetCamera();
If you can't find a better solution, consider placing a "Detect camera" button behind the camera feed. If the camera disconnects then the user would see the button and could click it to reconnect.
You can check if the camera object is null as suggested by #ToddBFisher, check the Camera.names.length>0 or a few other properties of the camera instance (see the links below). But in each of them you'll want to check it at a regular interval.
Working with Cameras
Monitoring Camera Status

AS3's attachAudio lowers volume?

I am having an issue with "attachAudio", any time I attach a microphone to netstream the audio goes down for the process I'm using (in the Volume Mixer). Is there any way around it?
Not sure. But maybe you mean this Windows 7 setting that reduces other applications sound.
http://www.mydigitallife.info/adjust-volume-level-when-place-or-receive-telephone-calls-in-windows-7/

Embed frame of a local .exe in a web browser

The question may sound a little odd but I'm currently in a project where this could help solving many problems.
Is it somehow possible to embed an .exe into any web browser? I don't want to run the program directly in the browser (would be major security risk I guess), I just want the window of the .exe being embeded into a browser page. So the .exe is running locally on the system but instead of a "windows window" I have it displayed in the web browser. Think of it like VNC, I only need my "video" and the possiblity of user interaction (the program is an interactive 3D visualization).
I don't have much hope for this being possible so I'm also glad about any suggestion that would allow me to display web pages while my program is running in the same (fullscreen) window. Doesn't necessarily has to be a "real" browser but should allow basic stuff like HTML, CSS etc.
This kinda sound more like a SuperUser question rather than a StackOverflow one.
Anyway, I have a number of possible solutions for you:
You could use a second monitor.
Maybe all you really need is setting the "exe" window to "always be on top".
I could swear that used to be an option in the Windows' default Task Manager in the earlier versions of Windows but I use a 3rd-party piece of software for around 10 years now for that and many other purposes, however there are many such options to be found online.
Can't risk endorsing the one I use here, since it tends to spook people into thinking I'm trying to infect them with HAX.
In case you have the sources for the "exe" you are running, have you considered going the other way around and building a web renderer into your desktop program? Something like WebKit, Servo and suchlike.
Or you could make the program listen on a port to network packets you can be sending from the page you'd have to make — like a remote control.
Then there's also the cgi-bin option if you run the server.
And, to see what you're controlling, you might wanna stream it to some streaming platform (if you get it to stream an obscured window), embed their player widget in an iframe on your custom local webpage and keep the website you are reaching in another frame.
Maybe even code the program to read XInput and stream it through Mixer using its MixPlay feature to control it.
Hope any of this helps.