Petnow LogoPetnow

Sound Guide

Play attention sounds with PetnowSound to draw a pet's attention.


Complete Basic Usage before starting this guide.

Overview

@petnow/react-native-camera-ui includes six built-in sounds for drawing a pet's attention. Use the PetnowSound API to encourage a pet to look at the camera during capture. It works independently of the camera, so it plays even without a camera view.

Available Sounds

Full sound list

Sound preview

Click each sound to preview it. Test how your pet reacts!

SoundDescriptionTargetPreview
🥔 bagOfChipsCrinkling chip bag🐕🐱 Both
🥫 openingCanCan-opening sound🐕🐱 Both
🍚 pouringFoodPouring kibble🐕🐱 Both
🥣 shakersShaking kibble🐕🐱 Both
🧸 squeakyToySqueaky toy sound🐕 Dog
😽 pspspsPspsps sound🐱 Cat

Basic Usage

Load the samples once with prepare() before playing any sound.

import { PetnowSound } from '@petnow/react-native-camera-ui';

await PetnowSound.prepare(); // Load samples (first time only)

1. Play a random sound

Automatically selects and plays a sound suitable for the species.

// Random sound for a dog
const handle = PetnowSound.play('random', 'DOG');

// Random sound for a cat
const handle = PetnowSound.play('random', 'CAT');

2. Play a specific sound

Choose and play a specific sound directly.

// Play the squeaky toy sound
const handle = PetnowSound.play('squeakyToy', 'DOG');

// Play the pspsps sound
const handle = PetnowSound.play('pspsps', 'CAT');

3. Stop a sound

To stop a sound, keep the handle returned when you played it.

// ⚠️ You won't be able to call stop() this way
PetnowSound.play('squeakyToy', 'DOG');  // return handle ignored

// ✅ Keep the handle to stop it
const handle = PetnowSound.play('squeakyToy', 'DOG');
// ... later
PetnowSound.stop(handle);

If play() returns -1, the sound did not play (prepare() was not called, or the sound is not mapped for the species). In that case, stop() does nothing.

4. Release resources

When you no longer need sounds, release the native audio resources.

PetnowSound.release();

Method summary

MethodDescription
prepare()Load samples (Promise). Call once before play — ideally ahead of time (e.g. at mount). iOS is on-demand (resolves immediately); Android preloads and resolves after loading completes
play(sound, species)Returns a stop handle (number, ≥0) after playing. -1 if not prepared/not mapped
stop(handle)Stop with the handle
release()Release native audio resources
  • sound: 'random' (selects a candidate suitable for the species) | 'pouringFood' | 'bagOfChips' | 'openingCan' | 'squeakyToy' | 'pspsps' | 'shakers'
  • species: 'DOG' | 'CAT' — used for 'random' candidate selection (ignored for other sounds).

Next Steps

  • Basic UsageusePetnowCamera + CameraView, events, commands, and lifecycle
  • Customization — Layering guide, buttons, and result UI on top of <CameraView>

On this page