Support » Plugin: WaveSurfer-WP » Problems creating a dynamic audio player

  • Resolved hurra03


    Hi – love this plugin!!

    When I use it in the traditional way with a fixed url for the source, it works beautifully. However, I’m having problems when I send a variable as the source.

    Here for instance, with pointy brackets, the default player appears, and plays theselected file correctly:

    <!DOCTYPE html>
    	<script type="text/javascript"></script>
    <div class="player">
    	<audio id='audio_core' src = '' controls ></audio>
    		var babyname = sessionStorage.getItem("babyname"), mypath=""+ babyname +".mp3", src=mypath,
    			audio_core=$('#audio_core').attr('src', src)[0]
    		audio_core.load() // <- play the song!!!

    but when I replace the pointy brackets on the audio shortcode with square brackets:

    [audio id='audio_core' src = '' controls][/audio]

    your player appears, but there’s no source.

    Thank you!!!!!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter hurra03


    Sorted the problem now – I changed the approach:

     <div id="myplayer"></div>
              var theDiv = document.getElementById("myplayer"), MusicName="FileName";
            var teststr = '[audio id="audio_name" mp3 = "'+MusicName+'.mp3" controls download_button="true" preload = "auto"][/audio]';
             theDiv.innerHTML += teststr; 
    Thread Starter hurra03


    see above

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problems creating a dynamic audio player’ is closed to new replies.