Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,731,360 Members 53,528 Now Online
XDA Developers Android and Mobile Development Forum

[Q] In-App Video Recording

Tip us?
 
jcreations4637
Old
(Last edited by jcreations4637; 4th March 2014 at 03:42 AM.) Reason: Added signature
#1  
Junior Member - OP
Thanks Meter 3
Posts: 26
Join Date: Dec 2013
Phone [Q] In-App Video Recording

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
One does not simply telnet into Mordor!
 
painlessDeath
Old
#2  
Junior Member
Thanks Meter 2
Posts: 13
Join Date: 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
 
jcreations4637
Old
(Last edited by jcreations4637; 8th March 2014 at 09:27 PM.) Reason: Added missing word
#3  
Junior Member - OP
Thanks Meter 3
Posts: 26
Join Date: Dec 2013
Quote:
Originally Posted by painlessDeath View Post
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.
One does not simply telnet into Mordor!
 
painlessDeath
Old
#4  
Junior Member
Thanks Meter 2
Posts: 13
Join Date: 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
 
jcreations4637
Old
#5  
Junior Member - OP
Thanks Meter 3
Posts: 26
Join Date: Dec 2013
Quote:
Originally Posted by painlessDeath View Post
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.
One does not simply telnet into Mordor!
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes