Media
Control the device's system volume. Set an exact level, nudge it up or down by one step, or read the current value. You can also listen for volume changes made by the user (hardware buttons, Control Center, etc.).
Access: startiapp.Media
Methods
setVolume(newVolume): Promise<void>
Sets the system volume to the specified value.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| newVolume | number | Yes | Target volume level between 0 (muted) and 1 (maximum). |
Returns: Promise<void> —Resolves when the volume has been set.
Example:
// Set volume to 50 %
await startiapp.Media.setVolume(0.5);getVolume(): Promise<number>
Gets the current system volume.
Returns: Promise<number> —The current volume level between 0 and 1.
Example:
const volume = await startiapp.Media.getVolume();
console.log(`Current volume: ${volume * 100}%`);increaseVolume(): Promise<void>
Increases the system volume by one step (the same increment as pressing the hardware volume-up button).
Returns: Promise<void> —Resolves when the volume has been increased.
Example:
await startiapp.Media.increaseVolume();decreaseVolume(): Promise<void>
Decreases the system volume by one step (the same decrement as pressing the hardware volume-down button).
Returns: Promise<void> —Resolves when the volume has been decreased.
Example:
await startiapp.Media.decreaseVolume();Events
volumeChanged
Fired whenever the system volume changes, whether triggered by your app, the user pressing hardware buttons, or system-level adjustments.
The event's detail property contains a VolumeChangedEventArgs object.
Example:
startiapp.Media.addEventListener("volumeChanged", (event) => {
const { volume } = event.detail;
console.log(`Volume changed to ${volume}`);
});Types
VolumeChangedEventArgs
Event payload attached to the volumeChanged event.
interface VolumeChangedEventArgs {
/** The new volume level (0 to 1). */
volume: number;
}Location
Access the device GPS, track location changes in real time, and set up geofences that trigger events when the user enters or exits a region.
Network
Monitor network connectivity and communicate over UDP on the local network. Useful for detecting online/offline state and discovering local devices.