Directory

← Back

AudioPlayer Add-on

Headless audio player using WebAudio API to allow streaming playback of an server-side PCM data buffer. Offers server side controls and pluggable effects.

Author

Contributors

Rating

AudioPlayer is an add-on for Vaadin that uses WebAudio to allow streaming playback of an arbitrary server-side PCM data buffer. Audio can be transported as WAV. It also supports server-side control of the audio playback such as audio and stereo balance, as well as advanced control via pluggable effects, such as highpass and lowpass filters.

Demo

Includes demo application that shows examples of most functionality including:

  • streaming different types of audio files
  • creating UI that connects to the audio player
  • server-side control of audio player
  • creating effect chains with pluggable effects

Installing

For more information about using the addon and/or running the demo application, see the README.md file or visit the github page: https://github.com/drewharvey/VaadinAudioPlayer

Sample code

        String filename = "somefile.wav";
        String filepath = "src/main/resources/org/vaadin/addon/audio/wav";
        // decodeToPcm method found in demo
        ByteBuffer fileBytes = decodeToPcm(filename, filepath);

        // createWaveStream method found in demo
        Stream stream = createWaveStream(fileBytes, new WaveEncoder());

        AudioPlayer player = new AudioPlayer(stream);

        // hook play button to AudioPlayer
        Button playButton = new Button("Play");
        playButton.addClickListener(buttonClickEvent -> {
            if (player.isStopped()) {
                player.play();
            } else if (player.isPaused()) {
                player.resume();
            }
        });

        add(player, playButton);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Version 3.1.0

  • Added range support
Released
2022-02-15
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 14
Polymer 3.0+ in 3.0.0
Vaadin 14+ in 3.0.0
Polymer 2.0+ in 2.0.2
Vaadin 7.7+ in 1.3
Browser
Firefox
Safari
Google Chrome
Internet Explorer
Online