Support

Account

Home Forums General Issues Can the audio file be loaded from the html code?

Solved

Can the audio file be loaded from the html code?

  • Hello, I would be very grateful if you could help me.
    I am trying to create a music library download website. For this I am using https://wavesurfer-js.org/
    But I see that it only allows to load the audio with JS. My question is this:

    Can the audio file be loaded from the html code? I see in the examples it only allows file loading from JavaScript
    Is there a way to do this. I am trying to dynamically load files from ACF.
    You can see a sample of what I’m trying to do from here http://rgmusic.net/waveExample/

    You can download all the code here: https://www.dropbox.com/s/5viv602w98pliph/waveExample.zip?dl=0

    Thank you very much.

  • Looking at the getting started page they give this example for loading a wave file

    
    wavesurfer.load('audio.wav');
    

    assuming that you are using a file field and have it set to return the url of the file, then the JS in your page would look something like this

    
    wavesurfer.load('<?php the_field('wave_file_field'); ?>');
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.