Android Streaming Using ParcelFileDescriptor and MediaRecorder

For streaming video over socket in Android, the following approach is taken

String hostname = "your.host.name";
int port = 1234;
Socket socket = new Socket(InetAddress.getByName(hostname), port);
ParcelFileDescriptor pfd = ParcelFileDescriptor.fromSocket(socket);
MediaRecorder recorder = new MediaRecorder();
// Additional MediaRecorder setup (output format ... etc.) omitted
recorder.setOutputFile(pfd.getFileDescriptor());
recorder.prepare();
recorder.start();

      

I have created a TCP server and I can receive messages on the TCP server using the socket object (code above) Output Stream. Also I can save the video by specifying the path, eg. "/sdcard/video.mp4" in setOutFile (). With the above code, I am getting nothing on the TCP server and also seeing MediaRecorder: start failed: -38 in the logs. Also I tried to close all running applications by going to Settings-> Applications-> Launch.

+3
android video sockets mediarecorder


source to share


No one has answered this question yet

See similar questions:

nineteen
MediaRecorder problem on Android Lollipop

or similar:

3606
Close / hide Android soft keyboard
3295
Why is the Android emulator so slow? How can we speed up the development of an Android emulator?
3288
Correct use cases for Android UserManager.isUserAGoat ()?
2609
Is there a unique identifier for an Android device?
2510
How to persist android activity state by persisting instance state?
2097
Is there a way to run Python on Android?
1858
"Debug certificate expired" error in Android Eclipse plugins
1844
What is "Context" on Android?
five
Streaming video in android by parcelFileDescriptor
2
Why is the video data from MediaRecorder associated with the DatagramSocket not transferred instantly?



All Articles
Loading...
X
Show
Funny
Dev
Pics