{"id":819,"date":"2016-09-13T20:17:50","date_gmt":"2016-09-13T12:17:50","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=819"},"modified":"2016-09-13T20:22:29","modified_gmt":"2016-09-13T12:22:29","slug":"html5%e8%a7%86%e9%a2%91%e6%92%ad%e6%94%be%e6%8f%92%e4%bb%b6video-js%e4%bd%bf%e7%94%a8%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=819","title":{"rendered":"HTML5\u89c6\u9891\u64ad\u653e\u63d2\u4ef6Video.js\u4f7f\u7528\u8be6\u89e3"},"content":{"rendered":"<p>\n\t\u73b0\u5728\u7684\u7a0b\u5e8f\u5f00\u53d1\uff0c\u57fa\u672c\u4e0a\u5c31\u662f\u4e00\u4e2a\u4f53\u529b\u6d3b\u3002\u5404\u79cd\u6846\u67b6\u6ee1\u5929\u98de\uff0c\u7cfb\u7edf\u7b28\u91cd\uff0c\u4f46\u662f\u6846\u67b6\u5e26\u6765\u7684\u597d\u5904\u4e5f\u662f\u663e\u800c\u6613\u89c1\u7684\u3002\u9996\u5148\u662f\u7f29\u77ed\u4e86\u5f00\u53d1\u5468\u671f\uff0c\u5176\u6b21\u662f\u964d\u4f4e\u4e86\u5f00\u53d1\u96be\u5ea6\uff0c\u8fd8\u6709\u5c31\u662f\u8ba9\u7a0b\u5e8f\u5458\u66f4\u5173\u6ce8\u4e1a\u52a1\u672c\u8eab\uff0c\u8bf4\u767d\u4e86\u5c31\u662f\u5e72\u4f53\u529b\u6d3b\u3002\n<\/p>\n<p>\n\t\u6700\u8fd1\u5404\u79cd\u76f4\u64adapp\uff0c\u5404\u4e2a\u76f4\u64ad\u5e73\u53f0\u7684\u5f00\u53d1\u5c97\u4f4d\u62db\u8058\u5f02\u5e38\u706b\u7206\u3002\u4eca\u5929\u5c31\u4e3a\u5927\u5bb6\u5206\u4eab\u4e00\u6b3eH5\u7684\u89c6\u9891\u63d2\u4ef6\uff0c\u8ba9\u6211\u4eec\u7b80\u5316\u89c6\u9891\u5f00\u53d1\u5e76\u62e5\u6709\u66f4\u597d\u517c\u5bb9\u6027\u7684\u652f\u6301\u5404\u6d4f\u89c8\u5668\u3002\n<\/p>\n<h2>\n\t\u64ad\u653e\u6548\u679c<br \/>\n<\/h2>\n<p>\n\t<img decoding=\"async\" alt=\"HTML5\u89c6\u9891\u64ad\u653e\u5668\" src=\"http:\/\/img.blog.csdn.net\/20140621201506890\" \/>\n<\/p>\n<h2>\n\tVideo.js\u7b80\u4ecb<br \/>\n<\/h2>\n<p>\n\tVideo.js \u662f\u4e00\u4e2a\u5f00\u6e90\u7684 Html5 jquery \u89c6\u9891\u63d2\u4ef6\uff0c\u8fd9\u4e2a\u63d2\u4ef6\u53ef\u4ee5\u7528\u6765\u5904\u7406 Flash \u89c6\u9891\uff0c\u5b83\u8fd8\u662f\u4e00\u4e2a\u591a\u5e73\u53f0\u652f\u6301\u7684\u4ea7\u54c1\u3002 Moreover\uff0cYouTube\uff0cVimeo \u7b49\u7b49\u7684\u89c6\u9891\u90fd\u53ef\u4ee5\u5f88\u597d\u5730\u901a\u8fc7\u8fd9\u4e2a\u63d2\u4ef6\u6765\u64ad\u653e\u3002\u8fd9\u4e2a\u63d2\u4ef6\u8fd8\u652f\u6301\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u548c\u5176\u5b83\u7684\u624b\u6301\u8bbe\u5907\u3002Video.js \u81ea\u52a8\u68c0\u6d4b\u6d4f\u89c8\u5668\u5bf9 HTML5 \u7684\u652f\u6301\u60c5\u51b5\uff0c\u5982\u679c\u4e0d\u652f\u6301 HTML5 \u5219\u81ea\u52a8\u4f7f\u7528 Flash \u64ad\u653e\u5668\u3002\n<\/p>\n<h2>\n\t\u5feb\u901f\u5165\u95e8<br \/>\n<\/h2>\n<p>\n\t\u6211\u4eec\u53ef\u4ee5\u4e0b\u8f7d Video.js \u7684\u6e90\u7801\u653e\u5230\u81ea\u5df1\u7684\u670d\u52a1\u5668\u4e0a\uff0c\u6216\u8005\u4f7f\u7528\u514d\u8d39\u7684 CDN \u6258\u7ba1\u7248\u672c\u3002\n<\/p>\n<h3>\n\t\u5728\u9875\u9762\u4e2d\u5f15\u7528video-js.cs\u6837\u5f0f\u6587\u4ef6\u548cvideo.js<br \/>\n<\/h3>\n<pre class=\"brush:xml;\">\r\n&lt;link href=&quot;video-js.css&quot; rel=&quot;stylesheet&quot; type=&quot;text\/css&quot;&gt;\r\n&lt;script src=&quot;video.js&quot;&gt;&lt;\/script&gt;<\/pre>\n<h3>\n\t\u4f7f\u7528\u514d\u8d39\u7684CDN\u6258\u7ba1\u7248\u672c<br \/>\n<\/h3>\n<pre class=\"brush:xml;\">\r\n&lt;link href=&quot;http:\/\/vjs.zencdn.net\/4.12\/video-js.css&quot; rel=&quot;stylesheet&quot;&gt;\r\n&lt;script src=&quot;http:\/\/vjs.zencdn.net\/4.12\/video.js&quot;&gt;&lt;\/script&gt;<\/pre>\n<h3>\n\t\u8bbe\u7f6eflash\u8def\u5f84\uff0cVideo.js\u4f1a\u5728\u4e0d\u652f\u6301html5\u7684\u6d4f\u89c8\u4e2d\u4f7f\u7528flash\u64ad\u653e\u89c6\u9891\u6587\u4ef6<br \/>\n<\/h3>\n<pre class=\"brush:xml;\">\r\n&lt;script&gt;\r\n    videojs.options.flash.swf = &quot;video-js.swf&quot;;\r\n&lt;\/script&gt;<\/pre>\n<p>\n\t\u5f15\u5165video\u6807\u7b7e\uff0c\u8fdb\u884c\u89c6\u9891\u64ad\u653e\n<\/p>\n<pre class=\"brush:xml;\">\r\n&lt;video id=&quot;xttblog&quot; class=&quot;video-js vjs-default-skin&quot; controls preload=&quot;none&quot; width=&quot;640&quot; height=&quot;264&quot;\r\n      poster=&quot;http:\/\/www.xttblog.com\/test\/oceans-clip.png&quot;\r\n      data-setup=&quot;{}&quot;&gt;\r\n    &lt;source src=&quot;http:\/\/www.xttblog.com\/test.mp4&quot; type=&#039;video\/mp4&#039; \/&gt;\r\n    &lt;source src=&quot;http:\/\/www.xttblog.com\/test.webm&quot; type=&#039;video\/webm&#039; \/&gt;\r\n    &lt;source src=&quot;http:\/\/www.xttblog.com\/test.ogv&quot; type=&#039;video\/ogg&#039; \/&gt;\r\n    &lt;track kind=&quot;captions&quot; src=&quot;demo.captions.vtt&quot; srclang=&quot;en&quot; label=&quot;English&quot;&gt;&lt;\/track&gt;&lt;!-- Tracks need an ending tag thanks to IE9 --&gt;\r\n    &lt;track kind=&quot;subtitles&quot; src=&quot;demo.captions.vtt&quot; srclang=&quot;en&quot; label=&quot;English&quot;&gt;&lt;\/track&gt;&lt;!-- Tracks need an ending tag thanks to IE9 --&gt;\r\n&lt;\/video&gt;<\/pre>\n<p>\n\t\u5982\u679c\u9700\u8981\u8bbe\u7f6e\u81ea\u52a8\u64ad\u653e\uff0c\u5c06\u4e0b\u9762\u4ee3\u7801\u52a0\u5230video\u540e\u9762\n<\/p>\n<pre class=\"brush:xml;\">\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\n    var myPlayer = videojs(&#039;xttblog&#039;);\r\n    videojs(&quot;example_video1&quot;).ready(function(){\r\n        var myPlayer = this;\r\n        myPlayer.play();\r\n    });\r\n&lt;\/script&gt;<\/pre>\n<h2>\n\t\u64ad\u653e\u6309\u94ae\u5c45\u4e2d<br \/>\n<\/h2>\n<p>\n\t\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5927\u7684\u64ad\u653e\u6309\u94ae\u662f\u88ab\u5b9a\u4e3a\u5728\u5de6\u4e0a\u89d2\u7684\uff0c\u8fd9\u6837\u5c31\u4e0d\u4f1a\u8986\u76d6\u89c6\u9891\u5185\u5bb9\u3002\u5982\u679c\u4f60\u60f3\u8ba9\u8fd9\u4e2a\u64ad\u653e\u6309\u94ae\u5c45\u4e2d\uff0c\u4f60\u53ef\u4ee5\u7ed9\u4f60\u7684 video \u6807\u7b7e\u6dfb\u52a0\u989d\u5916\u7684 vjs-big-play-centered \u6837\u5f0f.\u5982\u679c\u4f60\u8fd8\u5bf9\u64ad\u653e\u6309\u94ae\u6837\u5f0f\u4e0d\u6ee1\u610f\u53ef\u91cd\u65b0\u5b9a\u4e49.video-js .vjs-big-play-button{\/*\u8fd9\u91cc\u7684\u6837\u5f0f\u91cd\u5199*\/}\u3002\n<\/p>\n<pre class=\"brush:xml;\">\r\n&lt;video id=&quot;xttblog&quot; class=&quot;video-js vjs-default-skin vjs-big-play-centered&quot;\r\n  controls preload=&quot;auto&quot; width=&quot;640&quot; height=&quot;264&quot;\r\n  poster=&quot;http:\/\/www.xttblog.com\/test\/oceans-clip.png&quot;\r\n  data-setup=&#039;{&quot;example_option&quot;:true}&#039;&gt;\r\n&lt;\/video&gt;<\/pre>\n<h2>\n\t\u4e3a\u52a8\u6001\u52a0\u8f7d\u7684HTML\u5143\u7d20\u8bbe\u7f6eVideo.js<br \/>\n<\/h2>\n<p>\n\tweb \u9875\u9762\u6216\u8005\u5e94\u7528\u662f\u52a8\u6001\u52a0\u8f7d video \u6807\u7b7e\u7684\uff08ajax\uff0cappendChild\uff09,\u8fd9\u6837\u5728\u9875\u9762\u52a0\u8f7d\u540e\u8fd9\u4e2a\u5143\u7d20\u662f\u4e0d\u5b58\u5728\u7684\uff0c\u90a3\u4e48\u4f60\u4f1a\u60f3\u8981\u624b\u52a8\u8bbe\u7f6e\u64ad\u653e\u5668\u800c\u4e0d\u662f\u4f9d\u9760 data-setup \u5c5e\u6027\u3002\u8981\u505a\u5230\u8fd9\u4e00\u70b9\uff0c\u9996\u5148\u5c06 data-setup \u5c5e\u6027\u4ece video \u6807\u7b7e\u4e2d\u79fb\u9664\u6389\uff0c\u8fd9\u6837\u5728\u64ad\u653e\u5668\u521d\u59cb\u5316\u7684\u65f6\u5019\u5c31\u4e0d\u4f1a\u6df7\u4e71\u4e86\u3002\n<\/p>\n<pre class=\"brush:xml;\">\r\nvideojs(&quot;xttblog&quot;, {}, function(){\r\n  \/\/ Player (this) is initialized and ready.\r\n});<\/pre>\n<p>\n\tvideojs \u65b9\u6cd5\u4e2d\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u4f60\u7684 video \u6807\u7b7e\u7684 ID\uff0c\u7528\u4f60\u81ea\u5df1\u7684\u4ee3\u66ff\u3002<br \/>\n\t\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u9009\u9879\u5bf9\u8c61\u3002\u5b83\u5141\u8bb8\u4f60\u50cf\u8bbe\u7f6e data-setup \u5c5e\u6027\u4e00\u6837\u8bbe\u7f6e\u989d\u5916\u7684\u9009\u9879\u3002<br \/>\n\t\u7b2c\u4e09\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a &#039;ready&#039; \u56de\u8c03\u3002\u4e00\u65e6 Video.js \u521d\u59cb\u5316\u5b8c\u6210\u540e\uff0c\u5c31\u4f1a\u89e6\u53d1\u8fd9\u4e2a\u56de\u8c03\u3002\n<\/p>\n<p>\n\t<strong>\u7248\u6743\u58f0\u660e\uff1a\u672c\u6587\u4e3a\u535a\u4e3b\u539f\u521b\u6587\u7ae0\uff0c\u672a\u7ecf\u535a\u4e3b\u5141\u8bb8\u4e0d\u5f97\u8f6c\u8f7d\u3002<\/strong><\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=819\">HTML5\u89c6\u9891\u64ad\u653e\u63d2\u4ef6Video.js\u4f7f\u7528\u8be6\u89e3<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u73b0\u5728\u7684\u7a0b\u5e8f\u5f00\u53d1\uff0c\u57fa\u672c\u4e0a\u5c31\u662f\u4e00\u4e2a\u4f53\u529b\u6d3b\u3002\u5404\u79cd\u6846\u67b6\u6ee1\u5929\u98de\uff0c\u7cfb\u7edf\u7b28\u91cd\uff0c\u4f46\u662f\u6846\u67b6\u5e26\u6765\u7684\u597d\u5904\u4e5f\u662f\u663e\u800c\u6613\u89c1\u7684\u3002\u9996\u5148\u662f\u7f29\u77ed\u4e86 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[496,494,495,493],"class_list":["post-819","post","type-post","status-publish","format-standard","hentry","category-html5","tag-html5","tag-video","tag-video-js"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=819"}],"version-history":[{"count":2,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/819\/revisions"}],"predecessor-version":[{"id":821,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/819\/revisions\/821"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}