I managed to find a good video app sample at 
https://github.com/googlesamples/android-Camera2Video .  I forked this to 
make some simple utilitarian changes.  The result is functional, but not 
pretty at all.  For what I'm using it for, pretty isn't important.

My fork of this is at 
https://github.com/davidmichaelkarr/android-Camera2Video/tree/refinements 
.  I would paste some of the code from that here, but it might be more 
effective to just have you look at the code there.

What was surprising is that when I stop the video recording, it correctly 
saves the video, but when I look in the filesystem, I see both the real 
video and a zero-length video file.  The timestamp on the zero-length file 
is a few seconds later than the real video file.

I guess I understand why this is happening, but I'm not certain of the best 
way to resolve this.

The way the app is structured, the File to write the video to is set up 
when preview is initiated.  The file isn't written to unless I start 
recording video.  As a result, the file on disk is actually created when I 
start preview mode, even if I don't record a video that time that I started 
the app.

One possible strategy for cleaning up that zero-length file is somehow 
removing the file in "onPause" (or some variation of that).  Basically, to 
remove the file when I "stop using the app".

It might be cleaner to set up the file only when I start recording, but I'm 
not sure how to properly structure that to make that happen.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/33a278b0-dd08-407e-9738-251950cfe206%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to