- withLoginInfo 改为接收完整 opts(含 method/headers/params) - 等待 login_window 的 destroy 事件(=登录成功信号) - 登录成功后重试原始请求 - 重试仍401则返回null(避免死循环) - 用户手动关闭登录窗口时也触发重试,401则返回null
1.4 KiB
1.4 KiB
Camera
Widget Functionality: Used to access the device's camera for taking photos or recording videos. Supports features such as switching cameras, starting/stopping video recording, and capturing photos.
Type: Standard widget (an extension based on Popup)
Parent Widget: bricks.Popup
Initialization Parameters
| Parameter | Type | Description |
|---|---|---|
fps |
Number | Frame rate for video capture; default is 60 FPS |
type |
String | Widget mode; allowed values are 'picture' (photo mode) or 'recorder' (video recording mode) |
auto_dismiss |
Boolean | Whether the popup should automatically close; default is false (explicitly set in code) |
Note
:
opts.auto_dismiss = false;is forcibly set within the constructor.
Main Events
| Event | Trigger Condition | Data Carried |
|---|---|---|
shot |
Triggered when the user clicks the capture button | The captured image data URL (JPEG image in base64 format) |
recorded |
Triggered when video recording ends | The recorded video file object (File type, WebM format) |
Explanation:
- When
type='picture', clicking the capture button triggers theshotevent and returns the captured image data.- When
type='recorder', clicking the record button starts or stops recording. After stopping, therecordedevent is triggered and returns the recorded video file.