Android 在html页面中嵌入歌曲。一旦一首歌曲通过文件浏览器被选中,它就会在html页面中显示为缩略图
我想在html页面中嵌入歌曲。一旦一首歌曲通过文件浏览器被选中,它就会在html页面中显示为缩略图。 我想在HTML5中为这个函数 我尝试了以下方法:Android 在html页面中嵌入歌曲。一旦一首歌曲通过文件浏览器被选中,它就会在html页面中显示为缩略图,android,jquery,html,Android,Jquery,Html,我想在html页面中嵌入歌曲。一旦一首歌曲通过文件浏览器被选中,它就会在html页面中显示为缩略图。 我想在HTML5中为这个函数 我尝试了以下方法: function selaudio() { var audiopath=document.getElementById('audioFile').value; var audiopath="somefile"; document.getElementById("audioDiv").innerHTML+="<aud
function selaudio()
{
var audiopath=document.getElementById('audioFile').value;
var audiopath="somefile";
document.getElementById("audioDiv").innerHTML+="<audio src="+audiopath+" controls></audio><br/>";
}
看看这个JSFIDLE,它完全满足您的需求: 关键是使用
URL.createObjectURL
,而不是文件输入的原始路径
input type="file" name="file" accept="audio/*" onclick="selaudio()" id="audioFile" value="" placeholder="Upload Audio" data-theme="b"