Post Reply

Phone [Q] In-App Video Recording

OP jcreations4637

4th March 2014, 03:18 AM   |  #1  
OP Junior Member
Thanks Meter: 3
 
26 posts
Join Date:Joined: Dec 2013
More
Hello XDA!

I came across a service named "TestFairy", and I am interested in some of it's features, but it's TOS does not agree with my application. So, I wanted to ask if anyone knows how one could implement the In-App recording feature used in TestFairy in an Android application without root. I have already done some Googling to no avail, and I am just starting to make Android apps, so I don't know how this can be done.

You can see what feature I am talking about at testfairy.com by clicking "Demo" at the top or watching their intro video.

Edit: It would appear that it is implemented by screenshots in rapid succession. How could I do this or (better yet) just record a video of just my application without root?

Thanks for the insight!
jcreations
Last edited by jcreations4637; 4th March 2014 at 03:42 AM. Reason: Added signature
8th March 2014, 03:18 AM   |  #2  
Junior Member
Thanks Meter: 2
 
13 posts
Join Date:Joined: Feb 2013
If you only want to record the video on your device, you could use the new screenrecord shell command in KitKat

https://developer.android.com/about/versions/kitkat.html#44-screen-recording
8th March 2014, 09:17 PM   |  #3  
OP Junior Member
Thanks Meter: 3
 
26 posts
Join Date:Joined: Dec 2013
More
Quote:
Originally Posted by painlessDeath

If you only want to record the video on your device, you could use the new screenrecord shell command in KitKat

https://developer.android.com/about/...reen-recording

Thank you for mentioning it, but this doesn't work without root or without a computer, and I am trying to support devices down to Gingerbread, not just KitKat.
Last edited by jcreations4637; 8th March 2014 at 09:27 PM. Reason: Added missing word
9th March 2014, 01:36 AM   |  #4  
Junior Member
Thanks Meter: 2
 
13 posts
Join Date:Joined: Feb 2013
Ohh, I thought you just wanted to create a video demo of your app.

To add support for recording video for your own app, you would take the root view of your app, and add the screenshots of the view periodically to a video.

Example code

Code:
    // The root view you want to record.
    View rootView = getWindow().getDecorView();
    rootView.setDrawingCacheEnabled(true);
    
    // Record the view in a separate thread.
    new AsyncTask<View, Void, Void>() {
      @Override
      protected Void doInBackground(View... params) {
        View source = params[0];
        long time;
        int fps = 30;
        long frameDuration = 1000 / fps;
        while (!isCancelled()) {
          time = System.currentTimeMillis();
          addBitmpToVideo(source.getDrawingCache(), frameDuration);
          Thread.sleep(frameDuration);
        }
        return null;
      }
    }.execute(rootView);
You would have to implement addBitmpToVideo.


You could either user ffmpeg for this or if you only want ICS+ support, you could try using the hidden videoeditor API
http://stackoverflow.com/questions/14197757/android-video-editor-classes
9th March 2014, 07:30 PM   |  #5  
OP Junior Member
Thanks Meter: 3
 
26 posts
Join Date:Joined: Dec 2013
More
Quote:
Originally Posted by painlessDeath

Ohh, I thought you just wanted to create a video demo of your app.

To add support for recording video for your own app, you would take the root view of your app, and add the screenshots of the view periodically to a video.

Example code

Code:
    // The root view you want to record.
    View rootView = getWindow().getDecorView();
    rootView.setDrawingCacheEnabled(true);
    
    // Record the view in a separate thread.
    new AsyncTask<View, Void, Void>() {
      @Override
      protected Void doInBackground(View... params) {
        View source = params[0];
        long time;
        int fps = 30;
        long frameDuration = 1000 / fps;
        while (!isCancelled()) {
          time = System.currentTimeMillis();
          addBitmpToVideo(source.getDrawingCache(), frameDuration);
          Thread.sleep(frameDuration);
        }
        return null;
      }
    }.execute(rootView);
You would have to implement addBitmpToVideo.


You could either user ffmpeg for this or if you only want ICS+ support, you could try using the hidden videoeditor API
http://stackoverflow.com/questions/1...editor-classes

Thanks! I will try this out when I get the chance.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Java for Android App Development by ThreadRank