Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android MediaRecorder to record a Surface (not Camera)

I'm looking at the class MediaRecorder of the Android SDK, and I was wondering if it can be used to record a video made from a Surface. Example: I want to record what I display on my surface (a video game?) into a file. As I said in the title: I'm not looking to record anything from the camera.

I think it is possible by overriding most of the class, but I'd very much like some ideas... Beside, I'm not sure how the Camera class is used in MediaRecorder, and what I should get from my Surface to replace it.

Thank you for your interest!

PS: I'm looking at the native code used my MediaRecorder to have some clue, maybe it will inspire someone else: http://www.netmite.com/android/mydroid/frameworks/base/media/jni/

like image 617
Gyome Avatar asked Dec 04 '12 22:12

Gyome


People also ask

What is media recorder?

The MediaRecorder API enables you to record audio and video from a web app. It's available now in Firefox and in Chrome for Android and desktop.

What is Android MediaRecorder?

MediaRecorder class can be used to record audio and video files. After recording the media, we can create a sound file that can be played later. In this example, we are going to record the audio file and storing it in the external directory in 3gp format.

What is media recorder on Iphone?

Media Recorder records both audio and video recordings and save them into many different formats of your liking with just a few simple taps! All recordings will automatically appear on the Files app.


1 Answers

The ability to record from a Surface was added in Android Lollipop. Here is the documentation:

http://developer.android.com/about/versions/android-5.0.html#ScreenCapture

like image 99
matt snider Avatar answered Nov 02 '22 23:11

matt snider