{"id":3448,"date":"2013-09-11T21:18:04","date_gmt":"2013-09-11T21:18:04","guid":{"rendered":"http:\/\/www.dognmonkey.com\/techs\/?p=3448"},"modified":"2013-10-08T16:39:59","modified_gmt":"2013-10-08T16:39:59","slug":"john-dyer-html5-player","status":"publish","type":"post","link":"https:\/\/www.dognmonkey.com\/techs\/john-dyer-html5-player.html","title":{"rendered":"John Dyer HTML5 Player"},"content":{"rendered":"<p style=\"text-align: center;\"><em>These days with many browsers across the boards, HTML5 seems to get along with all of them. Flash player may not work in some devices. I found this <a title=\"John Dyer HTML5 Player\" href=\"\/\/mediaelementjs.com\/\" target=\"_blank\">John Dyer HTML5 player<\/a> that can play very well on WordPress. It&#8217;s simple to use and it does work well as core, but if you don&#8217;t have WordPress and use it on any other platform, this is how I would do it.<\/em><\/p>\n<p style=\"text-align: center;\"><em>Download the scripts and put on the footer or header. If you&#8217;re using many jquery, it&#8217;s a good\u00a0practice to define jquery.noConflict with the scripts.\u00a0<\/em><\/p>\n<blockquote><p>&lt;script src=&#8221;\/idogjs\/johndyer\/build\/jquery.js&#8221;&gt;&lt;\/script&gt;<br \/>\n&lt;script src=&#8221;\/idogjs\/johndyer\/build\/mediaelement-and-player.min.js&#8221;&gt;&lt;\/script&gt;<br \/>\n&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;\/idogjs\/johndyer\/build\/mediaelementplayer.min.css&#8221; \/&gt;<br \/>\n&lt;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\nvar $jD=jQuery.noConflict();<br \/>\n$jD(document).ready(function(){<br \/>\n});<br \/>\n&lt;\/script&gt;<br \/>\n&lt;script src=&#8221;\/idogjs\/johndyer\/ijohndyer.js&#8221; type=&#8221;text\/javascript&#8221;&gt;&lt;\/script&gt;<\/p><\/blockquote>\n<p style=\"text-align: center;\"><em>The ijohndyer.js is my special scripts to take care of all the scripts so we don&#8217;t have to repeat the scripts on every post or every player we use.<\/em><\/p>\n<blockquote><p>$jD(document).ready(function() {<\/p>\n<p>$jD(&#8216;audio,video&#8217;).mediaelementplayer({<\/p>\n<p>success: function(player, node) {<br \/>\n$jD(&#8216;#&#8217; + node.id + &#8216;-mode&#8217;).html(&#8216;mode: &#8216; + player.pluginType);<br \/>\n}<br \/>\n});<br \/>\n});<\/p><\/blockquote>\n<p style=\"text-align: center;\"><em>When everything is done, all we need to do to place an audio player is coded like this.<\/em><\/p>\n<blockquote><p>&lt;audio controls=&#8221;control&#8221; preload=&#8221;none&#8221; src=&#8221;\/music\/idog\/idogsunday.mp3&#8243; type=&#8221;audio\/mp3&#8243;&gt;&lt;\/audio&gt;<\/p><\/blockquote>\n<p style=\"text-align: center;\"><audio width=\"300\" height=\"32\" controls=\"controls\" preload=\"none\" src=\"\/music\/idog\/idogsunday.mp3\" type=\"audio\/mp3\"><\/audio><\/p>\n<p style=\"text-align: center;\"><em>For mp4 video player the code is like this.<\/em><\/p>\n<blockquote><p>&lt;video width=&#8221;560&#8243; height=&#8221;315&#8243; src=&#8221;\/media\/teststuff\/tasting.mp4&#8243; type=&#8221;video\/mp4&#8243;<br \/>\nid=&#8221;player1&#8243; poster=&#8221;\/media\/teststuff\/tn_cab04_75.JPG&#8221;<br \/>\ncontrols=&#8221;controls&#8221; preload=&#8221;none&#8221;&gt;&lt;\/video&gt;<\/p><\/blockquote>\n<p style=\"text-align: center;\"><video id=\"player1\" width=\"560\" height=\"315\" src=\"\/media\/teststuff\/tasting.mp4\" type=\"video\/mp4\" poster=\"\/media\/teststuff\/tn_cab04_75.JPG\" controls=\"controls\" preload=\"none\"><object id=\"player1\" width=\"560\" height=\"315\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,40,0\"><param name=\"src\" value=\"\/\/www.dognmonkey.com\/techs\/wp-includes\/js\/tinymce\/plugins\/media\/moxieplayer.swf\" \/><param name=\"flashvars\" value=\"url=\/media\/teststuff\/tasting.mp4&amp;poster=\/media\/teststuff\/tn_cab04_75.JPG\" \/><param name=\"allowfullscreen\" value=\"true\" \/><param name=\"allowscriptaccess\" value=\"true\" \/><embed id=\"player1\" width=\"560\" height=\"315\" type=\"application\/x-shockwave-flash\" src=\"\/\/www.dognmonkey.com\/techs\/wp-includes\/js\/tinymce\/plugins\/media\/moxieplayer.swf\" flashvars=\"url=\/media\/teststuff\/tasting.mp4&amp;poster=\/media\/teststuff\/tn_cab04_75.JPG\" allowfullscreen=\"true\" allowscriptaccess=\"true\" \/><\/object><\/video><\/p>\n<p style=\"text-align: center;\"><em>Since the scripts is taken care in the head or footer already, we never have to worry about it again.<\/em><\/p>\n<p style=\"text-align: center;\"><a class=\"preview\" rel=\"lightbox\" href=\"\/\/www.dognmonkey.com\/techs\/wp-content\/uploads\/2013\/09\/johndyer.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-3452\" alt=\"johndyer playver\" src=\"\/\/www.dognmonkey.com\/techs\/wp-content\/uploads\/2013\/09\/johndyer-300x166.jpg\" width=\"300\" height=\"166\" srcset=\"https:\/\/www.dognmonkey.com\/techs\/wp-content\/uploads\/2013\/09\/johndyer-300x166.jpg 300w, https:\/\/www.dognmonkey.com\/techs\/wp-content\/uploads\/2013\/09\/johndyer.jpg 561w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<ul class=\"lcp_catlist\" id=\"lcp_instance_0\"><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>These days with many browsers across the boards, HTML5 seems to get along with all of them. Flash player may not work in some devices. I found this John Dyer HTML5 player that can play very well on WordPress. It&#8217;s simple to use and it does work well as core, but if you don&#8217;t have <a href=\"https:\/\/www.dognmonkey.com\/techs\/john-dyer-html5-player.html\" class=\"more-link\">&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,20],"tags":[386,388,387],"class_list":["post-3448","post","type-post","status-publish","format-standard","hentry","category-tips-and-tricks","category-wordpress","tag-html5-player","tag-john-dyer","tag-mediaelement"],"views":315,"_links":{"self":[{"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/posts\/3448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/comments?post=3448"}],"version-history":[{"count":4,"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/posts\/3448\/revisions"}],"predecessor-version":[{"id":3450,"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/posts\/3448\/revisions\/3450"}],"wp:attachment":[{"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/media?parent=3448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/categories?post=3448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dognmonkey.com\/techs\/wp-json\/wp\/v2\/tags?post=3448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}