Video recording without specifing any output file

1k Views Asked by At

I'm aware of that there is a way of recording videos and saving it to a specific file. Here's a code sample:

MediaRecorder recorder = new MediaRecorder();
    recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
        recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);

        CamcorderProfile cpHigh = CamcorderProfile
                .get(CamcorderProfile.QUALITY_HIGH);
        recorder.setProfile(cpHigh);
        recorder.setOutputFile("/sdcard/videocapture_example.mp4"); //Saving the file to the sd card
        recorder.setMaxDuration(50000); 
        recorder.setMaxFileSize(5000000); 

My question: Is it possible to record a video without specifing any output file, but the output would be a byte array which is built from the record? My target is to prevent saving any file to my SD card. I don't really mind about using a 3rd party libraries, but prefer not to.

Thanks in advanced!

1

There are 1 best solutions below

0
On

This idea has been used in Spydroid project here Check the VideoStream class.

The output is set to a Local socket, then the data retrieved by another LocalSocket as a stream and may be manipulated as desired (writing to byte[]).