久久久久久99久久久|中文字慕人成字幕二区|中文在线不卡高清理论av|最新国产激情无码在线|亚洲五月天堂蜜臀在线观看|中国无码三级片在线观看

HTML5如何實(shí)現(xiàn)網(wǎng)頁(yè)播放器

2012/8/17 17:49:04   閱讀:5466    發(fā)布者:5466

   HTML5網(wǎng)頁(yè)播放器,主要用到了audio標(biāo)簽,讀取本地文件用的是FileReader API(貌似僅支持Chrome)?! 】创a,html代碼就只需要audio標(biāo)簽、文件上傳按鈕:
  <audio autoplay="autoplay" controls="controls" src="badday.mp3" loop="loop">
  <source src="badday.mp3" type="audio/ogg">
  <source src="badday.mp3" type="audio/mpeg">
  Your browser does not support the audio tag.  </audio>
  <input id="fileurl" type="file" onchange="play()"/>
  function play(){try{    var file=document.getElementById('fileurl').files[0];    var reader = new FileReader();    reader.onload = (function(file) {        return function(e){            $("audio").attr('src',e.target.result);
  $("source").attr('src',e.target.result);        }    })(file);    reader.readAsDataURL(file); } }catch(e){   alert("同學(xué),該換瀏覽器啦?。?!");  }