The APIs on this page will only work with SDK 4.9+.
Starts streaming the microphone to the app's PebbleKit JS companion.
stopped is required
Passed to the handlers
Stops streaming. Safe to call when not streaming.
true while the app is streaming to the phone, including while the phone has yet to accept the stream
Both handlers are required. Capture starts immediately on success.
Stops capture without calling stopped. Safe while idle.
Get the area next to the system Listening indicator, for the app's own content while it uses the microphone. On rectangular displays the indicator is a bar along the bottom of the screen that shrinks into a square in the bottom-left corner after a few seconds. The bar's height stays obstructed (see layer_get_unobstructed_bounds) and this is the rest of it, to the right of the square: a place for a timer, a level meter or a hint.
Draw in it whenever this returns true. The bar covers it at first and uncovers it as it shrinks, so there is nothing to time. It keeps the bar's height while the indicator slides in and out, so what is drawn in it moves with the indicator. The app redraws whenever it moves, as for the unobstructed area.
It is true from when the app starts using the microphone until the indicator has slid away. On round displays the indicator is a small dome that leaves no room, so this is always false: show that content in the unobstructed area instead.
The layer for which to get the area, in its coordinates. The area is clipped to the layer's sides, but not to its top or bottom.
The area, or an empty rectangle when there is none.
false when the app is not using the microphone, on round displays and when the area is beside the layer.
Result of mic_stream_to_phone_start.
The stream was requested; started is called once the phone accepts it.
The microphone is in use (by this app or the system)
The app is not in the foreground.
Invalid arguments.
Not enough memory to start the stream.
Watchfaces can never stream.
This watch has no microphone.
Why the stream ended.
The app stopped the stream.
The app lost focus, e.g. a notification appeared.
The system took the microphone, e.g. for dictation.
The phone refused, stopped or lost the stream.
An unexpected error.
Handler called once the phone has accepted the stream and audio is flowing.
Handler called when the stream ends for a reason other than the app stopping it. The stream is gone by the time it is called.
Runs on the app task. Samples are valid only during this callback. Slow consumers drop frames; each callback receives 320 samples (20 ms).
Called on the app task when capture ends involuntarily.
Local 16 kHz mono signed 16-bit PCM capture. Requires an explicit Microphone grant synced from the phone. Grants persist offline until updated by the phone. Only foreground watchapps can capture. The system displays its Listening banner (see layer_get_mic_accessory_bounds). Capture and mic_stream_to_phone_start cannot run at the same time.
Do you have questions about the Pebble SDK?
Do you need some help understanding something on this page?
Ask on the developer forum.