PDA

View Full Version : Replace swf flash audio web player by HTML5 web player



Fli
09-04-2017, 07:34 AM
Hi,

i had the mp3 flash player on my website and flash is no longer supported by many browsers:


<object type="application/x-shockwave-flash" data="&lt;?php echo $this-&gt;_tpl_vars['server']; ?&gt;
player/mp3player.swf?file=&lt;?php echo $this-&gt;_tpl_vars['url']; ?&gt;
&amp;autostart=false" width="350" height="20"><param name="movie" value="&lt;?php echo $this-&gt;_tpl_vars['server']; ?&gt;
player/mp3player.swf?file=&lt;?php echo $this-&gt;_tpl_vars['url']; ?&gt;
&amp;autostart=false" /></object>

At http://scriptgenerator.net/really-simple-embed-audio-player-script/ i found nice HTML5 web player embed code generator and this is the result in my case:


<audio controls loop preload="metadata" style=" width:350px;">
<source src="<?php echo $this->_tpl_vars['url']; ?>" type="audio/mpeg">
Your web browser does not support this media player
</audio>

And it works. One just need to replace source src="yourvariablehereMP3URL"

Do you know better audio web player code?