1

I'm building an app for Android 2.2 that will be a sort of "fake" camera. I'm playing video using a SurfaceView and exposing controls to a user to take photos and flip between front & rear facing "cameras".

I'd like to add animations for both that align with what's experienced in stock android. That is, when a user takes a photo the frame freezes, slides off to the right, and the live camera image slides in from the left. When a user switches between cameras, there is a 3d flipping animation that occurs.

The problem I've run into is with SurfaceView. I've read a number of posts stating that it isn't possible to get a bitmap from a SurfaceView because of the way it's tied into the OS and hardware.

I've also tried getting a frame of video and using an ImageView, but it looks like MediaMetadataRetriever isn't supported until API level 10. I've seen some posts saying it's available before (back to level 5), but I have no idea how to use that, or whether I should since it's not officially supported.

My last thought would be to override the drawing of the SurfaceView, and either apply some sort of matrix to affect the output, or export the pixel data to an external imageview, although I'm not sure the later option is possible.

Could anyone give me some guidance about what can be done here?

raydowe
  • 1,285
  • 1
  • 16
  • 31

1 Answers1

0

In the end, I couldn't find anything that worked.

I ended up:

  • Hiding the SurfaceView and showing an ImageView
  • Setting the ImageView content to (roughly) what was showing on the SurfaceView. This was probably the hardest part, as you cant usually get the contents of a SurfaceView.
  • Animating the ImageView
  • Hide the ImageView and show the SurfaceView again before playback resumes.
raydowe
  • 1,285
  • 1
  • 16
  • 31