Components / AudioPlayerButton

AudioPlayerButton

Plays and stops a recording, with progress and a transcript to open.

Example

The component itself, running in WebAssembly, beside its code in a playground. Try it.

Code

use ravenrs::prelude::*;

fn audio_player_button() -> impl View {
    // A second of a low tone, computed here. An app delivers its own recording.
    let tone: Vec<f32> =
        (0..44_100).map(|i| (i as f32 / 44_100.0 * 220.0 * std::f32::consts::TAU).sin() * 0.2).collect();
    AudioPlayerButton::new()
        .clip(SoundClip::new(tone, 44_100))
        .transcript("What was said goes here, to open when wanted.")
        .width(320.0)
}

Open in the playground, with every example →

Full API of AudioPlayerButton →