I have a app that runs a AudioPlaybackAgent and I want that everytime the phone receive a call, the audio get paused, but i didn't found anything about that.
If you are using Background Audio Manager, Phone will automatically Pause the playback and once call is disconnected it will automatically start playing.
Related
I have windows universal 8.1 app with two players. When I deploy locally using app deployment application or through visual studio it is working fine but when I submit app to the store, one player fails to work.
I am using microsoft player framework with this hls plugin https://phonesm.codeplex.com/
The player seems to load since I know player media opened event has triggered but player control is missing and there is no video or audio.
When try to play video content nothing happens but when I try to play audio only content I get audio but there is still no visible player control (player visibility is set to visible ofc).
The question is, how is it possible that the same package acts different whether deployed locally or acquired from store?
Due to the way that BackgroundAudio task and app lifecycle are built up, there doesn't seem to be a way to detect actual closing of the app and stopping its background task at this point.
This creates an odd situation for the user, where she can try to forcibly terminate the suspended-but-present app to "get rid" of the playing audio, yet the playback continues.
There is a possibility of reacting to the Suspending event, but that would just mean that the audio stops playing as soon as the user switches out of the app.
However, we are required to stop audio playback only when the user terminates the app via App Switch screen.
Is there any way of detecting that the app has been closed from its background task?
The BackgroundAudioTask is designed to continue even the main app has been terminated/suspended. There is no way to inform the BackgroundTask that the suspended app has been terminated.
After the app is suspended, no events are called or any code is run from your app. The last things what you can do is to put something into suspending event and/or window's events. You can save something in LocalSettings which will be inform the BackgroundTask that the app is inactive, it's also last chance to send a message to your task with information about UI status.
The above method is used in official MSDN sample.
I recently received some code from another developer and there's one piece I would like to rework. It's a flash app that works with mic and webcam. When it is started you are prompted to press a button - after that the usual flash player settings windows appears asking you to allow access to mic and cam. The application needs to wait for user's response on this question. It was achieved in the code I received in a rather awkward fashion. Application progressed on mouse movement event, which would not be registered since the flash player settings popup block the area. Once it out of the way - any mouse move would make application to go on. I need to rework with in some better way, because this piece of code is also used in AIR application that doesn't ask for allowance and, therefore, if you click the opening button you would need to move your mouse in order to get things running. I believe there must be some decent way to notify the app that settings popup is gone. Could anyone advice on this?
The correct way to do this in Flash Player is to listen for StatusEvent.STATUS event which is dispatched after the user either allows or denies you access to their mic. See the documentation for Microphone.getMicrophone().
In AIR, however, you don't have to ask for user's permission to access their mic and camera, so this event is not dispatched when your application gets access to the input device. In that case, you can check through Capabilities.playerType property if your code is running in AIR and then proceed with doing what you would have done in response to receiving permission to access user's input devices.
I am making a voice chat application and am accessing the microphone through the Flash Player. I check for the microphone via the Microphone.getMicrophone() function.
If the microphone is not connected the above function call output is null and thereby I tell the user, through a dialog box with an OK and SKIP button, that there is no microphone attached. If the user clicks on the OK button, I check for the microphone again else skip this step.
On Chrome, the flash player initially detects that no microphone is attached. I attach a microphone and it work fine. Now I refresh the page and remove the microphone again. Again the Flash Player checks for the microphone and the output of the above function is not null. I close Chrome and follow the above steps, it works fine again.
Does Chrome internally store the detected hardware settings anywhere? If yes, how can I clear it using AS3?
On Firefox and Internet Explorer, it works perfectly.
My app is running on the foreground and the phone getting a incoming call. In the scenario, the phone is not raising any event to app like deactivated or closing. How do I identify my app not running ?
You app actually is still the current foreground app (so, kind of running, but audio/video is paused for obvious reasons).
You will get an Obscured event in the app, but you can't distinguish if this due to an incoming call, an incoming SMS, toast or reminder.
Here is a link to the MSDN documentation of the Obscured event you get. There is a corresponding Unobscured event you can also detect.