title: What is the right way to rotate a camera widget?
body: <p>XCamera widget which extends Camera widget is rotated by 90 degrees on smartphones.</p>
  <p>I've seen people saying the below works but not for me:</p>
  <pre><code>from kivy.graphics.context_instructions import Rotate, PopMatrix, PushMatrix
  from kivy_garden.xcamera import XCamera
  from kivy.lang import Builder
  from kivy.app import App
  
  builder = Builder.load_string('''
  &lt;MyCam&gt;:
      orientation: 'vertical'
      XCamera:
          play: True
      canvas.before:
          PushMatrix
          Rotate:
              angle: -90
              origin: self.center
      canvas.after:
          PopMatrix
  ''')
  
  class MyCam(XCamera):
      pass
  
  class TestApp(App):
      def build(self):
          return builder
  
  TestApp().run()
  </code></pre>
  <p><strong>Update:</strong></p>
  <p>The builder variable in example above returns None because at the point when it's created it doesn't know what MyCam class is yet.</p>
  <p>This code works as desired but <strong>not with extended XCamera widget</strong>:</p>
  <pre><code>class MyCam(Camera):
      pass
  
  builder = Builder.load_string('''
  BoxLayout:
      MyCam:
          resolution: 1280, 720
          play: True
          canvas.before:
              PushMatrix:
              Rotate:
                  angle: -90
                  axis: 0,0,1
                  origin: root.width/2, root.height/2
          canvas.after:
              PopMatrix:
  ''')
  
  class TestApp(App):
      def build(self):
          return builder
  
  TestApp().run()
  </code></pre>
  <p>When I use <code>XCamera</code> instead of <code>Camera</code> the app crashes without Python-related error in logcat.</p>