Skip to content

Commit

Permalink
Fix the sample code (reported by @iskwmsy)
Browse files Browse the repository at this point in the history
  • Loading branch information
baku89 committed Jun 14, 2024
1 parent 7cce8ad commit bcf52ee
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ async function test() {
// It will display a prompt to select a USB camera
const camera = await manager.requestCamera('usb')

await cam.open()
await camera.open()

cam.name
camera.name
// -> 'Lumix S5'

await cam.set('shutterSpeed', '1/1000')
await camera.set('shutterSpeed', '1/1000')

const exposureModeDesc = await cam.getDesc('exposureMode')
const exposureModeDesc = await camera.getDesc('exposureMode')
console.log(exposureModeDesc)
/* -> {
value: 'M',
Expand All @@ -77,30 +77,30 @@ async function test() {
}
} */

const autoFocusResult = await cam.runAutoFocus()
const autoFocusResult = await camera.runAutoFocus()
// -> {status: 'ok'}

if (!autoFocusResult.status !== 'ok') {
console.warn('AF failed')
}

const takePhotoResult = await cam.takePhoto({download: true})
const takePhotoResult = await camera.takePhoto({download: true})

if (takePhotoResult.status === 'ok') {
const url = URL.createURLObject(takePhotoResult.value[0])
$img.src = url
}

// Get storage informations
const storages = await cam.getStorages()
const storages = await camera.getStorages()

for (const storage of storages) {
console.log('Storage ID= ' + storage.id)
console.log('name=' + storage.name)
console.log('free space in images=' + storage.freeSpaceInImages)
}

await cam.close()
await camera.close()
}
```

Expand Down

0 comments on commit bcf52ee

Please sign in to comment.