sockets - video streaming from an android phone to another android phone over a WiFi connection -
I am using a code that is available on a WiFi connection for streaming video from another Android phone to another Android phone
http://stackoverflow.com/questions/14401340/live-stream-video-from-one-android-phone-to-another-over-wifi
This is the server code:
// This is your network socket parcelfile descriptor pfd = parcel file descriptor. Frame socket (socket); MCamera = getCameraInstance (); MMediaRecorder = New MediaRecorder (); MCamera.unlock (); MMediaRecorder.setCamera (mCamera); MMediaRecorder.setAudioSource (MediaRecorder.AudioSource.CAMCORDER); MMediaRecorder.setVideoSource (MediaRecorder.VideoSource.CAMERA); // This is the informally supported MPEG2TS format, suitable for streaming (Android 3.0+) mMediaRecorder.setOutputFormat (8); MMediaRecorder.setAudioEncoder (MediaRecorder.AudioEncoder.DEFAULT); MMediaRecorder.setVideoEncoder (MediaRecorder.VideoEncoder.DEFAULT); MMediaRecorder.setOutputFile (pfd.getFileDescriptor ()); . //mMediaRecorder.setPreviewDisplay (mPreview.getHolder () getSurface ()); MMediaRecorder.prepare (); MMediaRecorder.start ();
And this is the client code:
// This is your network socket, the server is connected to ParcelFileDescriptor pfd = ParcelFileDescriptor.fromSocket (socket); MMediaPlayer = new Media Player (); MMediaPlayer.setDataSource (pfd.getFileDescriptor ()); MMediaPlayer.prepare (); MMediaPlayer.start ();
But the code for creating socket for both sides was, if I am using the UDP protocol?
(I do not ask this in a comment because I have not enough reputation for Hava)
Comments
Post a Comment