Current location - Music Encyclopedia - QQ Music - How to use HTML5 to create a web player that can play audio and video files in MP3, MP4 and other formats. The functions include start, pause,
How to use HTML5 to create a web player that can play audio and video files in MP3, MP4 and other formats. The functions include start, pause,

var?audioTag?=?document.createElement('audio');

if? (!(!!(audioTag.canPlayType)?&&?("no"?!=?audioTag.canPlayType("audio/mpeg"))?&&?(""?!=?audioTag.canPlayType("audio/mpeg "))))?{

AudioPlayer.embed("audioplayer_1",?{soundFile:?"your.mp3",?transparentpagebg:?"yes"});

$(?'#audioplayer').hide(); }

else?

{

$(?'#audioplayer'?).audioPlayer( );

}