HTML视频标签显示Youtube视频 [英] HTML video tag display Youtube video

查看:326
本文介绍了HTML视频标签显示Youtube视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到了一些youtube网址,例如 https://www.youtube的.com /嵌入/ LaXGkW_-NVC?列表= RDTDDDvaoGiDg 。当我把它放到html视频标签时,它会说无效的源码。

如何解决这个问题?

<当我使用iframe来显示视频时,我遇到了另一个问题,如下所述:



这是我的HTML :

 < video width =300height =autoautoplay =controls =name =media >< source src =https://www.youtube.com/embed/LaXGkW_-Nvc?list=RDTDDDvaoGiDg>< / video> 


解决方案

您无法在YouTube上使用HTML5视频代码视频,它只支持MP4,WebM和Ogg文件。 W3C学校



YouTube已经为您提供了一个嵌入功能,可以为您自动生成iFrame。 YouTube嵌入还有其他一些方法,但不再使用它们(不推荐)。 Youtube API



由于对于与IE的问题,也许看看这个类似的问题: YouTube iframe嵌入代码无法在IE中工作



如果您想使用HTML5视频标签是以指定格式之一下载Youtube视频。


I got some youtube urls, such as https://www.youtube.com/embed/LaXGkW_-Nvc?list=RDTDDDvaoGiDg. When I put it to html video tag, it said "Invalid source".

How to solve this problem?

When I used iframe to display videos, I had another problem as described here: Video not showing in iframe on IE, but showing on firefox and chrome.

This is my HTML:

<video width="300" height="auto" autoplay="" controls="" name="media"><source src="https://www.youtube.com/embed/LaXGkW_-Nvc?list=RDTDDDvaoGiDg"></video>

解决方案

You can't use the HTML5 video tag for youtube videos, it only supports files that are either MP4, WebM and Ogg. W3C Schools

Youtube already provides you with an "embed" function on their page which auto generates the iFrame for you. Youtube Embed There are a few other methods but they are no longer used (deprecated). Youtube API

As for the issue with IE, maybe have a look at this similar question: YouTube iframe embed code not working in IE

The only way around the issue if you want to use the HTML5 video tag is to download the Youtube video in one of the specified formats.

这篇关于HTML视频标签显示Youtube视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆