{"id":270,"date":"2024-05-21T10:16:07","date_gmt":"2024-05-21T08:16:07","guid":{"rendered":"https:\/\/blog.sutilweb.eu\/?page_id=270"},"modified":"2024-05-21T10:16:07","modified_gmt":"2024-05-21T08:16:07","slug":"61-video-en-html","status":"publish","type":"page","link":"https:\/\/sutilweb.eu\/index.php\/lenguajes\/html5\/html5-manual\/61-video-en-html\/","title":{"rendered":"61. Video en HTML"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">El elemento HTML <strong><em>&lt;video&gt;<\/em><\/strong> es usado para mostrar un video en una p\u00e1gina web.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ejm<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;video&nbsp;width=\"320\"&nbsp;height=\"240\"&nbsp;controls&gt;\n&nbsp;&nbsp;&lt;source&nbsp;src=\"movie.mp4\"&nbsp;type=\"video\/mp4\"&gt;\n&nbsp;&nbsp;&lt;source&nbsp;src=\"movie.ogg\"&nbsp;type=\"video\/ogg\"&gt;\nYour browser does not support the video tag.\n&lt;\/video&gt;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Como trabaja<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">El atributo <strong><em>controls<\/em> <\/strong>agrega controles de video, como reproducci\u00f3n, pausa y volumen. Es una buena idea incluir siempre los atributos <strong><em>width<\/em> <\/strong>y <strong><em>height<\/em><\/strong>. Si no se configuran la altura y el ancho, la p\u00e1gina puede parpadear mientras se carga el video.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">El elemento <strong><em>&lt;source&gt;<\/em><\/strong> permite especificar archivos de video alternativos que el navegador puede elegir. El navegador utilizar\u00e1 el primer formato reconocido.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">El texto entre las etiquetas <strong><em>&lt;video&gt;<\/em><\/strong> y <strong><em>&lt;\/video&gt;<\/em><\/strong> solo se mostrar\u00e1 en navegadores que no admitan el elemento <strong><em>&lt;video&gt;<\/em><\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Autoplay<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Para iniciar el video autom\u00e1ticamente se utiliza el atributo <strong><em>autoplay<\/em><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;video&nbsp;width=\"320\"&nbsp;height=\"240\"&nbsp;autoplay&gt;\n&nbsp;&nbsp;&lt;source&nbsp;src=\"movie.mp4\"&nbsp;type=\"video\/mp4\"&gt;\n&nbsp;&nbsp;&lt;source&nbsp;src=\"movie.ogg\"&nbsp;type=\"video\/ogg\"&gt;\nYour browser does not support the video tag.\n&lt;\/video&gt;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Agrega <strong><em>muted<\/em> <\/strong>despu\u00e9s de <strong><em>autoplay<\/em> <\/strong>para permitir que el video comience a reproducirse autom\u00e1ticamente (pero silenciado):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;video&nbsp;width=\"320\"&nbsp;height=\"240\"&nbsp;autoplay muted&gt;\n&nbsp;&nbsp;&lt;source&nbsp;src=\"movie.mp4\"&nbsp;type=\"video\/mp4\"&gt;\n&nbsp;&nbsp;&lt;source&nbsp;src=\"movie.ogg\"&nbsp;type=\"video\/ogg\"&gt;\nYour browser does not support the video tag.\n&lt;\/video&gt;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">M\u00e9todos, propiedades y eventos<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">El <strong>DOM<\/strong> de <strong>HTML<\/strong> define <strong>m\u00e9todos<\/strong>, <strong>propiedades<\/strong> y <strong>eventos<\/strong> para el elemento <strong><em>&lt;video&gt;<\/em><\/strong>. Esto permite cargar, reproducir y pausar videos, as\u00ed como configurar la duraci\u00f3n y el volumen. Tambi\u00e9n hay eventos <strong>DOM<\/strong> que pueden notificar cuando un video comienza a reproducirse, se detiene, etc.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>El elemento HTML &lt;video&gt; es usado para mostrar un video en una p\u00e1gina web. Ejm &lt;video&nbsp;width=\u00bb320&#8243;&nbsp;height=\u00bb240&#8243;&nbsp;controls&gt; &nbsp;&nbsp;&lt;source&nbsp;src=\u00bbmovie.mp4&#8243;&nbsp;type=\u00bbvideo\/mp4&#8243;&gt; &nbsp;&nbsp;&lt;source&nbsp;src=\u00bbmovie.ogg\u00bb&nbsp;type=\u00bbvideo\/ogg\u00bb&gt; Your browser does not&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":41,"menu_order":60,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","footnotes":""},"class_list":["post-270","page","type-page","status-publish","hentry"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Sutil Web","author_link":"https:\/\/sutilweb.eu\/index.php\/author\/sutilweb\/"},"uagb_comment_info":0,"uagb_excerpt":"El elemento HTML &lt;video&gt; es usado para mostrar un video en una p\u00e1gina web. Ejm &lt;video&nbsp;width=\"320\"&nbsp;height=\"240\"&nbsp;controls&gt; &nbsp;&nbsp;&lt;source&nbsp;src=\"movie.mp4\"&nbsp;type=\"video\/mp4\"&gt; &nbsp;&nbsp;&lt;source&nbsp;src=\"movie.ogg\"&nbsp;type=\"video\/ogg\"&gt; Your browser does not...","_links":{"self":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/270","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/comments?post=270"}],"version-history":[{"count":2,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/270\/revisions"}],"predecessor-version":[{"id":272,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/270\/revisions\/272"}],"up":[{"embeddable":true,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/41"}],"wp:attachment":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/media?parent=270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}