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 405cd50
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ async function test() {
const manager = new TethrManager()

// It will display a prompt to select a USB camera
const camera = await manager.requestCamera('usb')
const camera = await manager.requestCamera('ptpusb')

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 405cd50

Please sign in to comment.