@@ -162,8 +162,9 @@ def _configure_camera(self, start):
162162
163163 # Device Rotate
164164 def on_size (self , instance , size ):
165- self .stop_capture_video ()
166- self ._configure_camera (False )
165+ if self ._camera :
166+ self .stop_capture_video ()
167+ self ._configure_camera (False )
167168
168169 ##################################
169170 # Parse options
@@ -263,8 +264,8 @@ def capture_screenshot(self, location = '.', subdir = '', name = ''):
263264
264265 # Select back, front camera
265266 def select_camera (self , facing ):
266- facing = facing .lower ()
267267 if self ._camera :
268+ facing = facing .lower ()
268269 if facing == 'toggle' :
269270 if self .facing == 'back' :
270271 self .facing = 'front'
@@ -281,7 +282,8 @@ def select_camera(self, facing):
281282 self .stop_capture_video ()
282283 self ._facing_ev = Clock .schedule_interval (
283284 self .can_select_camera , 1 / 30 )
284- return self .facing
285+ facing = self .facing
286+ return facing
285287
286288 def can_select_camera (self ,dt ):
287289 if not self .capture_in_progress :
@@ -302,7 +304,8 @@ def flash(self):
302304 else :
303305 self .flash_state = 'off'
304306 self .flash_state = self ._camera .flash (self .flash_state )
305- return self .flash_state
307+ return self .flash_state
308+ return "off"
306309
307310 # if enable_focus_gesture == True, then this is called by a tap gesture
308311 def focus (self , x , y ):
0 commit comments