Xamarin Forms Customized Camera for iOS and Android, Custom Renderer?

Oliv3rOliv3r USMember ✭✭
edited June 2017 in Xamarin.Forms

I'm pretty new to Xamarin Forms and C# in general, and need som hints on the best way to create an app for iOS and Android. I want to use the Camera to take pictures / videos and later on send them through email or something, since I want customized controls on the camera, I'm guessing the stock camera won't be an option? Which gets us to Renderers, which is the best approach to this? Preferably in a MVVM way. I just want the camera and a few customized buttons on it.

Do I make on renderer for the different buttons objects and one for the camera, the buttons I'll do as extensions of the Button class, but what about the camera?

/Oliver

Answers

  • BjornBBjornB USMember ✭✭✭
    edited June 2017
    Look at the Xamarin forms app called moment, a simple Google search and you should find it. There they use a custom camera controll that you can customize natively
  • Oliv3rOliv3r USMember ✭✭

    Thanks for the tip @BjornB. Have looked som into moment, it's similar to Xamarin forms Custom Renderer sample Content Page.

    There's some things that I don't like with this approach though:
    Layout and handlers is being handled natively and not in PCL, thereby it's being done twice. would also rather have the camera as a view than a page, so that it could be put in another page using xaml or code.

  • Oliv3rOliv3r USMember ✭✭

    And they also uses the old Hardware.Camera in the Android Renderer, which is obsolete since API 21 and replaced by Camera2 @BjornB

  • QuakeulfQuakeulf NOMember ✭✭✭

    There is this for Camera2, but it is anything but basic:

    https://developer.xamarin.com/samples/monodroid/android5.0/Camera2Basic/

    Is this not possible to do in a simpler way for PCL?

  • StryffeStryffe USMember ✭✭

    @Quakeulf & @Oliv3r Take a look here for an embeddable solution using Camera2 instead of Camera for displaying a live Camera View inside your own app. The iOS version can be found here. Works well for me so hope it helps you guys as well!

Sign In or Register to comment.