{"id":1083,"date":"2011-10-06T17:52:38","date_gmt":"2011-10-06T22:52:38","guid":{"rendered":"http:\/\/www.uv.mx\/personal\/gvera\/?p=1083"},"modified":"2020-10-25T09:41:47","modified_gmt":"2020-10-25T15:41:47","slug":"como-colocar-un-video-en-wordpress-usando-html5","status":"publish","type":"post","link":"https:\/\/www.uv.mx\/personal\/gvera\/2011\/10\/06\/como-colocar-un-video-en-wordpress-usando-html5\/","title":{"rendered":"Como colocar un video en WordPress usando HTML5"},"content":{"rendered":"<p><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2011\/10\/video-html5.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2011\/10\/video-html5-300x167.jpg\" alt=\"\" width=\"300\" height=\"167\" class=\"aligncenter size-medium wp-image-1264\" srcset=\"https:\/\/www.uv.mx\/personal\/gvera\/files\/2011\/10\/video-html5-300x167.jpg 300w, https:\/\/www.uv.mx\/personal\/gvera\/files\/2011\/10\/video-html5.jpg 495w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Para ver un video en HTML 5 lo primero que debemos entender es que necesitas un navegador compatible con el nuevo tag o etiqueta HTML de video. IE9, Firefox \u00f3 Chrome en su \u00faltima versi\u00f3n son opciones ya disponibles.<\/p>\n<h3>WordPress<\/h3>\n<p>Como ya lo has de saber, WordPress no te permite colocar tags como \u00abobject\u00bb, \u00abiframe\u00bb o \u00abvideo\u00bb dentro de nuestro editor de texto. Bueno, si tienes el perfil administrator si que lo puedes hacer; pero pensemos en que somos otro perfil como el de Editor. Un usuario con perfil Editor, s\u00f3lo puede colocar las siguientes etiquetas:<!--more--><\/p>\n<p><code> address, a, abbr, acronym, area, article, aside, b, big, blockquote, br, caption, cite, class, code, col, del, details, dd, div, dl, dt, em, figure, figcaption, footer, font, h1, h2, h3, h4, h5, h6, header, hgroup, hr, i, img, ins, kbd, li, map, ol, p, pre, q, s, section, small, span, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var <\/code><\/p>\n<p>Fuente: <a title=\"Clic para ver\" href=\"http:\/\/en.support.wordpress.com\/code\/\" target=\"_blank\" rel=\"noopener noreferrer\">Sitio WordPress Support<\/a><\/p>\n<h3>Soluci\u00f3n<\/h3>\n<p>Est\u00e1 f\u00e1cil, solo debemos saber donde moverle. Hay soluciones que te dicen que tienes que instalar por fuerza el plugin <a title=\"Clic para ver\" href=\"http:\/\/wordpress.org\/extend\/plugins\/tinymce-advanced\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u00abTinyMCE Advanced\u00bb<\/a>. No es cierto. Aunque es TinyMCE Advanced es un gran plugin, no est\u00e1 hecho para solo para eso. La soluci\u00f3n est\u00e1 ah\u00ed, frente a ti. Pero primero debes tener un poco de imaginaci\u00f3n e irte por un cafecito para relajarte.<\/p>\n<p>Todo se basa en un archivito que tienes por ahi en tu carpeta wp-includes que se llama <em>kses.php<\/em>. Si lo abres ahora mismo ya sabr\u00e1s donde est\u00e1 la soluci\u00f3n. Sino, aqu\u00ed paso a paso: 1. Abre tu archivo functions.php y observalo. Mmmm bonito no? 2. Agregat\u00e9 esta funci\u00f3n que se ejecute en el init de tu p\u00e1gina cuando est\u00e9s en la administraci\u00f3n:<\/p>\n<p>[php]<br \/>\nadd_action(&#8216;init&#8217;, &#8216;memo_kses_init&#8217;);<br \/>\nif ( ! function_exists( &#8216;memo_kses_init&#8217; ) ):<br \/>\n\/**<br \/>\n * Kses global for default allowable HTML tags.<br \/>\n *<br \/>\n * Ahora permite varios html tags para mis usuarios no administradores<br \/>\n *<br \/>\n *\/<br \/>\nfunction memo_kses_init() {<br \/>\n\tif (is_admin() ) {<br \/>\n\t\tglobal $allowedposttags;<br \/>\n\t\t$allowedposttags[&#8216;video&#8217;] = array(<br \/>\n\t\t\t\t&#8216;audio&#8217; =&gt; array (),<br \/>\n\t\t\t\t&#8216;preload&#8217; =&gt; array (),<br \/>\n\t\t\t\t&#8216;height&#8217; =&gt; array (),<br \/>\n\t\t\t\t&#8216;loop&#8217; =&gt; array (),<br \/>\n\t\t\t\t&#8216;poster&#8217; =&gt; array (),<br \/>\n\t\t\t\t&#8216;src&#8217; =&gt; array (),<br \/>\n\t\t\t\t&#8216;width&#8217; =&gt; array (),<br \/>\n\t\t\t\t&#8216;controls&#8217; =&gt; array (),<br \/>\n\t\t\t\t&#8216;autoplay&#8217; =&gt; array ()<br \/>\n\t\t\t\t);<br \/>\n\t\t$allowedposttags[&#8216;source&#8217;] = array(<br \/>\n\t\t\t\t&#8216;media&#8217; =&gt; array (),<br \/>\n\t\t\t\t&#8216;src&#8217; =&gt; array (),<br \/>\n\t\t\t\t&#8216;type&#8217; =&gt; array ()<br \/>\n\t\t\t\t);<br \/>\n\t\t\t\t\/\/Aqu\u00ed puedes agregar m\u00e1s y m\u00e1s tags como iframe, embed y hasta object. Asegurate de saber lo que haces =)<\/p>\n<p>\t}<br \/>\n}<br \/>\nendif;<br \/>\n[\/php]<\/p>\n<p>3. Guarda tu archivo functions.php y listo! Ya puedes poner tu video usando est\u00e9 lindo c\u00f3digo:<\/p>\n<p>[html]<br \/>\n\/\/Video en HTML5<\/p>\n<p>&lt;video preload=&quot;preload&quot; controls=&quot;controls&quot; autoplay=&quot;autoplay&quot; height=&quot;240&quot; width=&quot;300&quot;&gt;<br \/>\n &lt;source src=&quot;http:\/\/colaboracion.uv.mx\/dgti\/ddiaa\/gvera\/videos\/big_buck_bunny.mp4&quot; \/&gt;<br \/>\n &lt;source src=&quot;http:\/\/colaboracion.uv.mx\/dgti\/ddiaa\/gvera\/videos\/big_buck_bunny.webm&quot; \/&gt;<br \/>\n&lt;\/video&gt;<\/p>\n<p>[\/html]<\/p>\n<p>A IE9 solo le gusta el mp4. Pero puedes usar tambi\u00e9n ogv \u00f3 webm en chrome y firefox. Por cierto tambi\u00e9n se ve en tu iphone o en tu Windows Phone con IE9.<\/p>\n<p>Tal como te pongo el ejemplo aqui mismo (recuerda lo de usar navegador compatible):<\/p>\n<div align=\"center\"><video preload=\"preload\" controls=\"controls\" autoplay=\"autoplay\" width=\"300\"><source src=\"https:\/\/test-videos.co.uk\/vids\/bigbuckbunny\/mp4\/h264\/720\/Big_Buck_Bunny_720_10s_1MB.mp4\" \/><\/video><\/div>\n<p>El v\u00eddeo es el primer minuto de la pel\u00edcula Big Buck Bunny.<br \/>\n(c) copyright 2008, Blender Foundation \/ <a href=\"http:\/\/www.bigbuckbunny.org\" target=\"_blank\" rel=\"noopener noreferrer\">www.bigbuckbunny.org<\/a><\/p>\n<p>S\u00f3lo ten cuidado al cambiar a vista HTML en el editor de WordPress pues se cree muy inteligente y te lo echar\u00e1 a perder.<\/p>\n<p><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2011\/10\/vista-html.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1129\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2011\/10\/vista-html-300x212.jpg\" alt=\"\" width=\"300\" height=\"212\" srcset=\"https:\/\/www.uv.mx\/personal\/gvera\/files\/2011\/10\/vista-html-300x212.jpg 300w, https:\/\/www.uv.mx\/personal\/gvera\/files\/2011\/10\/vista-html.jpg 634w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Por eso vamos a modificar un poquito el editor TinyMCE.<\/p>\n<h3>Soluci\u00f3n al formateo de TinyMCE<\/h3>\n<p>Vas a agregar un filtro en tu archivo de funciones. Esto va a deshabilitar el plugin \u00abmedia\u00bb que viene con el editor. No hace nada m\u00e1s que ayudarte a poner archivos de media embebidos. Ya sabes, videos de flash y eso. Aqui puedes leer mas:<\/p>\n<p><a title=\"Clic para ver\" href=\"http:\/\/www.uv.mx\/personal\/gvera\/2011\/10\/06\/como-colocar-un-video-en-wordpress-usando-html5\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.tinymce.com\/wiki.php\/Plugin:media<\/a><\/p>\n<p>Agrega este c\u00f3digo al functions.php de tu tema (\u00f3 tambi\u00e9n puedes hacerte un plugin).<\/p>\n<p>[php]<br \/>\nadd_filter(&#8216;tiny_mce_before_init&#8217;, &#8216;memo_tiny_mce_before_init&#8217;);<br \/>\nif ( ! function_exists( &#8216;memo_tiny_mce_before_init&#8217; ) ):<br \/>\n\/**<br \/>\n *<br \/>\n * Deshabilita el plugin &#8216;media&#8217; del TinyMCE<br \/>\n *<br \/>\n *\/<br \/>\nfunction memo_tiny_mce_before_init( $initArray ) {<br \/>\n\t\/\/ Quita el plugin de media<br \/>\n\t$initArray[&#8216;plugins&#8217;] = str_replace(&#8216;media,&#8217;,\u00bb,$initArray[&#8216;plugins&#8217;]);<br \/>\n\treturn $initArray;<br \/>\n}<br \/>\n[\/php]<\/p>\n<p>Y aunque cambies de vista c\u00f3digo a vista HTMl, el editor tinyMCE ya no se meter\u00e1 con tus c\u00f3digos.<\/p>\n<p><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2011\/10\/tiny-media.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1151\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2011\/10\/tiny-media-300x205.jpg\" alt=\"\" width=\"300\" height=\"205\" srcset=\"https:\/\/www.uv.mx\/personal\/gvera\/files\/2011\/10\/tiny-media-300x205.jpg 300w, https:\/\/www.uv.mx\/personal\/gvera\/files\/2011\/10\/tiny-media.jpg 621w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>En esa misma funci\u00f3n puedes tambi\u00e9n modificar los valores iniciales del editor; ya sabes, los botones, el tama\u00f1o, etc. Todo viene del archivo <em>wp-admin\/includes\/post.php<\/em>.<br \/>\nEchale una mirada para que empieces a moverle.<\/p>\n<h3>Hemos terminado<\/h3>\n<p>Poco a poco m\u00e1s y m\u00e1s sitios se actualizan a HTML5. Creo que falta muy poco para que la mayor\u00eda de sitios <del datetime=\"2011-10-07T19:03:48+00:00\">obliguen <\/del>inviten a sus usuarios a utilizar un navegador compatible con HTML5.<\/p>\n<p>Gracias a estos sitios amigos en la red que me apuntaron en la direcci\u00f3n correcta:<\/p>\n<p>Fuente: <a title=\"Clic para ver\" href=\"http:\/\/www.w3schools.com\/html5\/html5_reference.asp\" target=\"_blank\" rel=\"noopener noreferrer\">HTML5 Tag Reference<\/a><br \/>\nFuente: <a title=\"Clic para ver\" href=\"http:\/\/wpquicktips.wordpress.com\/2010\/03\/12\/how-to-change-the-allowed-html-tags-for-wordpress\/\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress Quick Tips<\/a><br \/>\nFuente: <a title=\"Clic para ver\" href=\"www.tinymce.com\/wiki.php\" target=\"_blank\" rel=\"noopener noreferrer\">Documentaci\u00f3n tinyMCE<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Para ver un video en HTML 5 lo primero que debemos entender es que necesitas un navegador compatible con el nuevo tag o etiqueta HTML de video. IE9, Firefox \u00f3 Chrome en su \u00faltima versi\u00f3n son opciones ya disponibles. WordPress Como ya lo has de saber, WordPress no te permite colocar tags como \u00abobject\u00bb, \u00abiframe\u00bb&#8230;<\/p>\n","protected":false},"author":2,"featured_media":1264,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,27],"tags":[16,77,78,30],"class_list":["post-1083","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","category-wordpress-2","tag-diario-2","tag-html-2","tag-html5","tag-videos-2"],"_links":{"self":[{"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/posts\/1083","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/comments?post=1083"}],"version-history":[{"count":2,"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/posts\/1083\/revisions"}],"predecessor-version":[{"id":2138,"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/posts\/1083\/revisions\/2138"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/media\/1264"}],"wp:attachment":[{"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/media?parent=1083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/categories?post=1083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/tags?post=1083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}