Can I get audio data from microphone in background task? - windows-phone-8

I want to implement a feature in Windows Phone 8, let it calculate decibel by using the audio data from microphone in background task. Is it possible?

You can't access the microphone from a background task according to this:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202962(v=vs.105).aspx
Unsupported APIs:
System.Windows.Media A/V Capture
Microsoft.Xna.*

Related

Android use MediaMuxer combine h264+aac stream, but i found some questions

here is my question:
I use Android Apis "MediaMuxer" to combine h264 stream and aac stream to mp4 file,when I want to stop record,so I call this:mMediaMuxer.stop(),and the mp4 file can play well.
but sometimes,there is an unexpected happen,like kill power or power is gone suddendly,so there is no time to call "mMediaMuxer.stop()",finally this file can not play anyway....
Is anybody know now to fix this problem? I want to play this video event didn't call "mMediaMuxer.stop()" this method... or there is other Apis or sdk can combine h264+aac stream well?

Error when Play file .mp3 (StorageFile ) with BackgroundMediaPlayer in isolated storage windows phone 8.1 rt

I use Windows Phone 8.1 Runtime
I get my song in isolated storage
My code :
storageFile is song in isolated storage
IRandomAccessStream stream = await storagefile.OpenAsync(FileAccessMode.Read);
BackgroundMediaPlayer.Current.SetStreamSource(stream);
BackgroundMediaPlayer.Current.Play();
When I play it,but it not work , like photo (try emulator and device lumina 520)
http://photoshare7.com/image/f5a
_message:
Unable to cast object of type 'Windows.Media.Playback.MediaPlayer ' to type 'Windows.Media.Playback.IMediaPlayerSource'
Please Help me .Tks all.Sr my English.
I just ran into the same issue :) This happens when you call SetStreamSource from foreground application. See [https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn642090.aspx]. To play audio from a file, you need to send background audio player a message (see [How to pass an object to background project in Windows Phone?).

SimpleWebRTC: consume video when peer machine has no webcam and microphone

I am using SimpleWebRTC to create a video chat room application.
One of the requirements is, a peer machine that has no microphone and webcam, should atleast be able to hear and see the video of other peers.
Is it possible to do?
I tried this using constraints{audio: false, video: false} in regular webRTC and it works on a machine that has no microphone and webcam.
How to accomplish this using simpleWebRTC?
Thanks!
I am not familiar with simpleWebRTC, but I use PeerJS. To answer even if you don't have a webcam or mic, all I do is I answer with 'null' instead of the stream.
So in Peerjs instead of
call.answer(window.localStream);
you can say
call.answer(null);
Try to find the code in SimpleWebRTC where the call is made or answered and try this.

Adobe Air - Choose webcam manually

How to choose the webcam/camera manually in Adobe Air? In Flash it's working through this:
Security.showSettings(SecurityPanel.CAMERA);
Is there something like that in Adobe Air?
Thank
In the Adobe Air Player (up to 3.4) there is no equivalent of the Flash Player security panel that can be triggered with Security.showSettings(SecurityPanel.CAMERA);
If you want to let the user pick a camera, you will have to create some sort of menu by using the info from the Camera.names array. Then, you can assign the user's choice via code by using something like :
var cam:Camera = Camera.getCamera('1');
Important: contrary to what was said above you CANNOT specify the camera by name. The getCamera() function expects a string representation of the camera's index number as a parameter. This is weird behaviour but it's how it works. So if you want to retrieve the second camera, you will have to pass the string '1' to the getCamera() function.
If you try to set the camera by specifying it's name, the function will return null.
I don't think there is any feature that you can use to select camera in AIR.
Instead you have to do it by coding.
get list of cameras using Camera.names property and then get selected camera instance using Camera.getCamera("name of camera");
I think this is best way to Do it.
Do you really need that typical dialog?
You can set a camera manually first by showing a list by:
var cameraNames:Array = Camera.names;
And then.....
var cameraInstance:Camera = Camera.getCamera('selectedCameraName');

How to capture sound from the Line-In device

I am trying to record the sound of my device connected to Line-In via ActionScript 3.
According to adobe docs ( http://livedocs.adobe.com/flex/3/html/help.html?content=Working_with_Sound_02.html ), The Microphone class lets your application connect to a microphone or other sound input device on the user's system .
But the Microphone class detects only microphones on my sound card ( Microphone.names array ) , not the "other sound input devices". Maybe there is another way to capture sound from Line-In devices?
Thank you!
Flash is built with security in mind, it won't let you access any hardware except predefined classes like Microphone and Camera (and only after user permission!)
You may have better luck with plugging the device into microphone socket or reroute its signal programmatically, if your soundcard software allows it.