Android :: MediaRecorder - MediaPlayer Simultaneous Use
Apr 16, 2010With reference to this discussion, does this mean that simultaneous Record and Playback with Mediarecorder and Mediaplayer is not possible at this point?
View 3 RepliesWith reference to this discussion, does this mean that simultaneous Record and Playback with Mediarecorder and Mediaplayer is not possible at this point?
View 3 RepliesI have a requirement to play several sounds many times in my game so instead of creating the MediaPlayer again and again I have called mp.seekTo(0) in onCompletion(mp) so that it will restart. Sometimes the sound is not audible from the device when I call mp.start () after setting mp.seekTo(0); but the player calls onCompletion() without playing any sound, this is observed randomly on most of the sounds
My sounds are of short duration mostly less than a second.
I am using a separate MediaPlayer for each sound (as I need this) -
There are almost 28 sounds in my game so i will be creating 28 MediaPlayers.
Below is the attached code for player
Also If I try to play many sounds one after the other in a short period of time i get an error saying "no more track names available". can u tell Why this is happening...?
check the below code:
CODE:........
Implementing a service to handle connection changes and downloads. The service handles a queue of AsyncTasks, each representing a "download task". This way, we can cancel/pause tasks when connection drops, and also restore them when connection is reestablished. Since the threads AsyncTasks are run are not deterministic, how many ATs should I execute() at the same time?
I've read that I shouldn't reuse tasks. How can I achieve this pause->resume functionality then? Should I tell the thread to sleep? Should I make a no-op while if connection is down? I was trusting the cancel(true) method, which I've read is not reliable either.
My main DownloadTask is a subclass of AsyncTask that returns a new AsyncTask to be called when the connection is restored.
I was wondering whether Androd can catch simultaneous Key Press. For example, a application does something when a user press HOME and MENU key simultaneously. Is it a possible scenario?
View 4 Replies View RelatedI am working on an art project with several other people that involves simultaneity and photography. We want to coordinate a series of events involving simultaneous photographs based on the Android system.
In simple terms, here is what we are proposing. Someone writes an app for Android Phone/Camera that makes the camera take a photograph at a predetermined time so that many thousands of people all take a simultaneous photograph. The art involved here is not only the synchronizing of the event to approximate simultaneity but also making "social networking" into an element of an art project.
Is there a limit on the number of simultaneous http requests of the form:
HttpResponse response = client.execute(request);
I'm interested in any official limit as well as practical ones.
(In a previous life, you had to dig deep to discover that WinMo only allowed three WebRequests to be open at a time.)
Let's say I have a list of 20 files to download on a background thread.
Should I: Download them one at a time, blocking the thread (but not the UI thread) to wait for each one? Start 20 threads each downloading one of the files?
I expect the answer may be somewhere in between, where I create C threads and work on the queue of N files, where C is a number like 3 or 4.
I suspect some of you here have already done some experimentation and know the magic number. In addition, I suspect there may be more efficient ways of doing what I'm doing than creating a new DefaultHttpClient for each request.
I am performing several https posts and http downloads from two different servers using AsyncTasks. The connections are fairly quick but I'm surprised to see that they are running synchronously instead of in parallel.
To be more explicit, here is pseudo-code for what's happening when I initiate a call to AsyncTask1():
CODE:..............
I'm trying to read from a file while it still opened for witing.
View 2 Replies View RelatedDoes anyone know how to use the MediaRecorder to API to capture video?
I am writing an application where I want to be able to capture video. I am trying to use the MediaRecorder API in 1.5, which is supposed to support video capture. However, there are no examples in the documentation on how to use this API for video (only for audio, and that works perfect). Basically what I do is the following:
CODE:...............
This gives me the following error: E/CameraInput( 37): No surface is available for display E/MediaRecorder( 7609): prepare failed: -2147483648
OK, so I have to have a surface to preview the video? Could be useful I guess, but not something I really need.
Could I use the VideoView widget for this, or is that only for playback?
Or am I supposed to use a SurfaceView to preview the video? I saw someone use that to capture images, but they used android.hardware.Camera to open the camera and capture a frame, and did not use MediaRecorder.
HOw to capture video, or even better have some example code?
I just installed the latest DialerOne (1.2.7.1) from the Market and find that the new simultaneous search of the call log and contacts is annoying in that it places call log entries at the top of the list, and tapping on them brings up the call history for that contact instead of listing their numbers so you can choose one to dial. I don't see any way to turn this off.Am I missing something?It would seem natural to have the ability to limit the search to the screen presented (search only the call log when the call log is displayed, or search only the contacts when contacts are displayed), but I have Dialer One display the call log by default, so that I can quickly call a recently called contact, or just start dialing to search, so this wouldn't work for me either.I would much rather go back to the way it used to be. Of course, I figured I didn't need to backup the previous version because after all, what could change? Now I have this, and the coloring of the digits on the keypad is weird, even after adjusting it as much as possible.
View 5 Replies View RelatedI have an android app, where in a list view for each element in list, I load an image from web in a separate thread. So if there are 8 items displayed in list view, activity will try to fire 8 different threads, one for each list item to load an image. As you scroll down the list, the number of threads may increase if the previous threads haven't finished executing.
I am curious to know how many simultaneous threads can a single android app execute in parallel? Is there a limit? I wouldn't expect these threads to cause a ANR over slow internet connection as they are independent? But it seems that ANR does happen and may be it's because app/device run low on resources, so spawning a new activity in UI takes more than 5 seconds which results in an ANR?
Any clues to how I can make responsiveness better on a slow internet connection will be appreciated.
I am trying to implement a functionality when i press the VOLUME DOWN and POWER BUTTON simultaneously; i must be able to run a method code inside my Activity.
public boolean onKeyUp(int keyCode, KeyEvent event)
{
}
From my initial search; it seems that only one such key press event is acknowledged at a time in Android usng the onKeyUp method. Is it true?
In my Android phone, on simultaneously pressing POWER BUTTON as well as MENU BUTTON i am able to capture a screen shot.
Does this feature not acknowledge simultaneous key presses?
I want to get the stream and send it to server directly by using MediaRecorder.
Actually, I am able to record the video,and able to store it into sdcard. Now I want to it to stream (live stream) to server rather than storing it.
I'm using MediaRecorder.setOutputFile(FileDescriptor fd) over a UNIX socket, so that local code on the device can see the encoded stream in real time (for video streaming out).
What I observed is that the encoder doesn't write encoded frames continuously, when they are produced, but by "bursts", exactly one second apart. I tried both containers (THREE_GPP and MPEG_4) and all three available codecs (MPEG_4_SP, H263, H264), the behavior is always the same. This one-second period is notably unrelated to framerate or bitrate, so it is not flushing by size; rather, it seems to be flushing by time (possibly to mask SD card write overheads ? Bummer, I 'm not using the SD here !). Is it a known limitation ? Is there a known workaround ?
Is anyone else experiencing poor playback quality on files recorded with MediaRecorder? Is there a way to improve this?
View 4 Replies View Relatedthe location where the audioflinger, surfaceflinger and cameraservice talk to MediaRecorder's APIs? Is there any relation between MediaRecorder and AudioRecord?
View 6 Replies View RelatedI am trying to develop an application with Android 1.5(cupcake_r1) for a week but always get an error reported in prepare of MediaRecorder. Can anybody help me to figure out the problem I got in the code below:
PS. In order to figure out the problem, I suppressed the audio recording, and the SDcard is installed in the phone.code...
I wrote a code to record audio of call conversation using MediaRecorder.
how can i know whether a MediaRecorder is in running state or not, to stop the recording.
like
CODE:............
Above code is just an example.. If you do not understand my question, please tell me.. i will explain clearly with actual code..
What all i want to know is "In which state the MediaRecorder is?" -> recording/released/prepared/initial/etc..
When I record audio with the MediaRecorder, I am consistently getting .65 seconds of dead space before the recording starts. It appears as if the file gets passed for some reason. Does anyone know why and better yet, how to eliminate this?
View 2 Replies View RelatedCan you please tell me how can I keep the MediaRecorder keeps recording after an orientation change? I try looking into source code of packages/apps/SoundRecorder/src/com/android/soundrecorder/Recorder.java, I don't see it handles that cases.
View 1 Replies View RelatedIf you don't need 3G on to do voice calls, then why would having it on not allow you to use your data connection while on a voice call?
View 9 Replies View RelatedI just saw a video of a Verizon guy that got FROYO already. They were showing the changes included in 2.2 and it had the option to update all the apps at the same time or something similar. I thought that was art of 2.2.
View 2 Replies View RelatedI probably don't need it persay...But! I want it! Just to have the peace of mind that phone calls won't interupt stuff. There have been times that I could both at the same time. Anyone think it might be implementef later? This is a real dream killer for me.
View 35 Replies View RelatedIs this suppose to work only with 4G or am I missing something?
View 3 Replies View RelatedWhy android doesn't permit to record audio from speakers, for example in incoming calls ?
I've searched in the web and there is no way to record incoming stream audio...the only why is the follow :
Java: MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
that records from microphone. Why this terrible bug?
I have founded some app that records incoming calls,
Dear PV engineer: I have try several days for this. We want to add video conference function in PV opencore, so we need to create video capture node in native mode, I try the following code to capture video, My code is like this:
CODE:......................
Is there a way to get the best quality of video recording possible using MediaRecorder? the camcorder app does a lot better in terms of quality.
View 5 Replies View RelatedWhen I record video by MediaRecorder, it always records in landscape mode, regardless of real device orientation. How to force MediaRecorder/Camera use real orientation ?
View 1 Replies View RelatedI try to use the MediaRecorder class to record a video but I get an exception : failed to get Camera parameters. Prepare failed.
Here's my code :
CODE:.....................
I am trying to use the MediaRecorder to record audio. I read the documentation at http://developer.android.com/reference/android/media/MediaRecorder.html on how to use the MediaRecorder and then tried the sample code given in the documentation for recording audio which is:
MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setOutputFile(PATH_NAME); recorder.prepare(); recorder.start(); // Recording is now started ... recorder.stop(); recorder.reset(); // You can reuse the object by going back to setAudioSource() step recorder.release(); // Now the object cannot be reused
However this code doesn't seem to work. The second line throws an exception when I execute the code. If I execute the following two lines of code:
MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
It throws a RuntimeException on the call to setAudioSource with the exception message "setAudioSource failed." I am running this on my T- Mobile HTC G1 Android device which is running Android v1.6
I have searched a number of forums for entries about "MediaRecorder" or "setAudioSource" and have found that a number of other people have also posted that they are having a similar problem. However no one has responded to any of the posts which I found regarding this issue.
I would appreciate some help if anyone knows why the MediaRecorder is not working as documented or can provide information on how to get past this exception.