CameraCaptureController

CameraCaptureController

Camera Capture Controller

Provides enhanced mobile camera capture functionality. Works in conjunction with HTML5 file input capture attribute.

Note: Most camera functionality is handled by HTML5 capture="environment" attribute. This controller provides UI enhancements and fallback behavior.

Targets:

  • cameraInput: File input with camera capture
  • cameraButton: Optional button to trigger camera
  • preview: Preview area for captured images

Actions:

  • triggerCamera: Open device camera
  • handleCapture: Handle image capture

Constructor

new CameraCaptureController()

Source:

Methods

connect()

Description:
  • Initialize controller

Source:

detectMobileDevice()

Description:
  • Detect if user is on mobile device Updates UI to show mobile-specific instructions

Source:

formatFileSize(bytes) → {string}

Description:
  • Format file size

Source:
Parameters:
Name Type Description
bytes number

File size in bytes

Returns:

Formatted size

Type
string

handleCapture(event)

Description:
  • Handle image capture Called when user selects/captures an image

Source:
Parameters:
Name Type Description
event Event

File input change event

showImagePreview(file)

Description:
  • Show image preview (optional enhancement)

Source:
Parameters:
Name Type Description
file File

Image file to preview

triggerCamera(event)

Description:
  • Trigger camera input Useful if you have a custom camera button instead of using the file input directly

Source:
Parameters:
Name Type Description
event Event

Button click event

(static) supportsCameraCapture() → {boolean}

Description:
  • Check if browser supports camera capture

Source:
Returns:

True if capture is supported

Type
boolean