• Resolved hurra03

    (@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>
    <html>
    <head>
    	<script type="text/javascript"></script>
    </head>
    <body>
    <div class="player">
           
     
    	<audio id='audio_core' src = '' controls ></audio>
    
    	<script>
    		var babyname = sessionStorage.getItem("babyname"), mypath="https://myluckyname.com/wp-content/uploads/2019/03/"+ babyname +".mp3", src=mypath,
    			audio_core=$('#audio_core').attr('src', src)[0]
    		audio_core.load() // <- play the song!!!
            
    	</script>
           
          
    
    </div>
    </body>
    
    </html>
    
    

    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

    (@hurra03)

    Sorted the problem now – I changed the approach:

     <div id="myplayer"></div>
           <script>
              var theDiv = document.getElementById("myplayer"), MusicName="FileName";
           
            var teststr = '[audio id="audio_name" mp3 = "https://myluckyname.com/wp-content/uploads/2019/04/'+MusicName+'.mp3" controls download_button="true" preload = "auto"][/audio]';
    
             theDiv.innerHTML += teststr; 
           </script>
    
    Thread Starter hurra03

    (@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.