Sound Guide
Sound playback that draws a pet's attention using CameraController's playSound.
Before starting this guide, complete Basic Usage.
Overview
The UI module includes 6 built-in sounds to attract pets' attention. With the playSound() / stopSound() API of CameraController, you can encourage a pet to look at the camera during capture.
Available Sounds
Complete Sound List
Sound Preview
Click each sound to preview it. Test your pet's reaction!
The preview names below are sample audio file names; in code, use the constant in the SoundType column.
| Sound | SoundType | Description | Target | Preview |
|---|---|---|---|---|
| 🥔 bagOfChips | BAG_OF_CHIPS | Chip bag rustling sound | 🐕🐱 Both | |
| 🥫 openingCan | OPENING_CAN | Can opening sound | 🐕🐱 Both | |
| 🍚 pouringFood | POURING_FOOD | Food pouring sound | 🐕🐱 Both | |
| 🥣 shakeFood | SHAKERS | Food shaking sound | 🐕🐱 Both | |
| 🧸 squeakyToy | DOG_ONLY_SQUEAKY_TOY | Squeaky toy sound | 🐕 Dogs | |
| 😽 pspspsSound | CAT_ONLY_PSPSPS | Pspsps sound | 🐱 Cats |
Basic Usage
1. Play a Random Sound
Automatically selects and plays a sound appropriate for the species.
import io.petnow.ui.sound.SoundType
private var selectedStreamSoundId: Int = -1
// Play a random sound (controller = CameraController)
selectedStreamSoundId = controller.playSound(SoundType.RANDOM)2. Play a Specific Sound
Directly select and play the sound you want.
private var selectedStreamSoundId: Int = -1
// Can opening sound
selectedStreamSoundId = controller.playSound(SoundType.OPENING_CAN)3. Stop a Sound
private var selectedStreamSoundId: Int = -1
// Stop the playing sound
controller.stopSound(selectedStreamSoundId)