html5播放視頻且動態(tài)截圖實現(xiàn)步驟與代碼(支持safari其他未測試)_HTML5教程

      編輯Tag賺U幣

      推薦:html5指南-7.geolocation結合google maps開發(fā)一個小的應用
      今天我們將把html5的geolocation結合google maps開發(fā)一個小的應用,感興趣的朋友可以了解下,如有不足,愿大俠給予指教

      暫不支持chrom 。支持safari .其他未測試
      先引用 jquery 地址。選用新浪的

      復制代碼 代碼如下:www.wf0088.com

      <script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.6/jquery.js"></script>

      加一個video標簽

      復制代碼 代碼如下:www.wf0088.com

      <video id="video" controls="controls">
      <source src="1.mp4" />
      </video>

      然后js

      復制代碼 代碼如下:www.wf0088.com

      <script type="text/javascript">
      $().ready(function(){
      var video, output;
      var scale = 0.25;
      var initialize = function() {
      output = $("#output");
      video = $("#video").get(0);
      $("#capture").click(captureImage);
      };
      var captureImage = function() {
      var canvas = document.createElement("canvas");
      canvas.width = video.videoWidth * scale;
      canvas.height = video.videoHeight * scale;
      canvas.getContext('2d')
      .drawImage(video, 0, 0, canvas.width, canvas.height);
      var img = document.createElement("img");
      img.src = canvas.toDataURL();
      output.prepend(img);
      };
      $(initialize);
      });
      </script>

      效果圖就不貼了。

      分享:使用html5+css3來實現(xiàn)slider切換效果告別javascript+css
      提到slider,過去一直都是用css+js來配合實現(xiàn)相關的切換效果。聽過大家一直討論使用html5+css3的實現(xiàn)方式,自己卻一直沒有動手實現(xiàn)過。好吧,這次我有時間來玩下css3了,感興趣的朋友可以了解下哦

      來源:未知//所屬分類:HTML5教程/更新時間:2013-04-22
      相關HTML5教程