docs: fix incorrect API examples and default in camera docs#4030
Merged
Conversation
Three docs corrections, each verified against the source of truth in
the package:
- recorder.mdx: the `startRecording` example wrapped its callbacks in
an object literal (`startRecording({ (path, reason) => ..., ... })`),
which is a SyntaxError. `startRecording` takes positional arguments
(`onRecordingFinished, onRecordingError, onRecordingPaused?,
onRecordingResumed?`) per Recorder.nitro.ts; the positional form is
already used correctly in video-output.mdx. Rewrote the example to the
positional form.
- photo-quality.mdx: the default JPEG compression was documented as
`0.95` (95% quality). The actual default is `0.9`
(usePhotoOutput.ts uses `quality = 0.9`, and CameraPhotoOutput.nitro.ts
documents `@default 0.9`). Changed `0.95` -> `0.9` and `95%` -> `90%`.
- getCameraDevice.ts: the DeviceFilter.physicalDevices `@example` called
`getCameraDevice({ physicalDevices: [...] })` (single object), but the
signature is `getCameraDevice(devices, position, filter)`. The
function-level `@example` already shows the 3-arg form. Fixed the two
example lines to `getCameraDevice(devices, 'back', { physicalDevices:
[...] })`.
|
Someone is attempting to deploy a commit to the Margelo Team on Vercel. A member of the Team first needs to authorize it. |
Owner
|
Cool thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While reading the docs I hit three example snippets that don't match the actual API. Each fix below is checked against the source of truth in the repo.
1.
startRecordingexample is a SyntaxError (docs/content/docs/recorder.mdx)The "Starting a Recording" snippet passes the callbacks inside an object literal:
Bare arrow functions as object members aren't valid JS, so this throws
SyntaxError: Unexpected token '('.startRecordingactually takes positional arguments:startRecording(onRecordingFinished, onRecordingError, onRecordingPaused?, onRecordingResumed?)(seeRecorder.nitro.ts). The positional form is already used correctly invideo-output.mdx, so this just makesrecorder.mdxconsistent with it.2. Wrong default JPEG quality (
docs/content/docs/photo-quality.mdx)The page says the default compression is
0.95(95% quality). The real default is0.9:usePhotoOutputdestructuresquality = 0.9(src/hooks/usePhotoOutput.ts), and the Nitro spec documents@default 0.9(CameraPhotoOutput.nitro.ts). Updated0.95to0.9and95%to90%.3.
getCameraDevice@exampleuses the wrong call shape (src/devices/getCameraDevice.ts)The
DeviceFilter.physicalDevicesJSDoc@examplecallsgetCameraDevice({ physicalDevices: [...] })(a single object), but the function signature isgetCameraDevice(devices, position, filter). The function-level@examplein the same file already shows the correct 3-argument form, so I updated the twophysicalDevicesexample lines to match:getCameraDevice(devices, 'back', { physicalDevices: [...] }).Docs-only change, no runtime code touched.