Audio API
January 6, 2026 ยท View on GitHub
The webcc::audio module provides a simple interface for playing audio files.
Header
#include "webcc/audio.h"
Functions
create_audio
Creates a new audio object from a source URL. Returns an Audio handle, which can be implicitly converted to DOMElement for use with DOM functions.
webcc::Audio create_audio(webcc::string_view src);
Playback Control
void play(webcc::Audio handle);
void pause(webcc::Audio handle);
Properties
void set_volume(webcc::Audio handle, float vol);
void set_loop(webcc::Audio handle, uint8_t loop);
float get_current_time(webcc::Audio handle);
float get_duration(webcc::Audio handle);