Problems creating a dynamic audio player
-
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"> <h1>名字:<script type="text/javascript"> var babyname = sessionStorage.getItem("babyname") document.write(babyname) </script> </h1> <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> <h2>意義:<script type="text/javascript"> var babyname = sessionStorage.getItem("babyname") </script> </h2> <p> 这是根据你的选择而设计的名字 </p> <p> 请随意下载音频文件并与家人和朋友分享 </p> <p> 我们建议最多选出三个名字,这样你与家人和朋友分享时可以去粗取精。 </p> <p><a href="https://myluckyname.com/find-my-english-name/">请点击这里从我们的代理处请求另一个名字</a></p>' </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 is passed (so the buttons appear, but there is no waveform).
Thank you!!!!!
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Problems creating a dynamic audio player’ is closed to new replies.