如何将YouTube视频添加为< video>而不是嵌入的< iframe&gt ;? [英] How to add YouTube video as <video> instead of an embedded <iframe>?

查看:100
本文介绍了如何将YouTube视频添加为< video>而不是嵌入的< iframe&gt ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



由于重量和设计方面的问题,我想知道是否可以指定YouTube视频作为< video> 标记的 src 属性,而不是嵌入的< iframe> ;



我想要一个YouTube视频,而不需要播放器的设计,并尽可能兼容不同的设备(例如浏览器,智能手机,平板电脑)。



您有任何想法或解决方案吗?

解决方案

我不知道是否有可能不使用iframe。但是你可以改变很多Youtube播放器的设计。据我所知,应该与移动设备兼容。

只需打开Youtube视频。点击分享。点击嵌入。点击显示更多。取消选中显示播放器控件,显示视频标题和播放器操作和视频播放完成时显示建议的视频。复制Iframe标记。



您可以手动更改iframe的宽度。



示例:

 < iframe width =560height =315src =https://www.youtube.com/embed/xmhnNUotIaE " rel = 0& amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; 


I have to insert a full width video on a website.

Because of problems of weight and design, I would like to know if I can specify the YouTube video as the src attribute of a <video> tag instead of an embedded <iframe>.

I would like to have a YouTube video without the design of the player and be as compatible with different devices as possible (e.g. browser, smartphones, tablets).

Do you have any ideas or solutions?

解决方案

I dont know if its possible to not use an Iframe. But you can change a lot of the design of the Youtube player. Should be compatible with mobile devices as far as i know.

Just Open the Youtube Video. Click on share. Click on Embed. Click on Show more. Uncheck "Show player controls","Show video title and player actions" and "Show suggested videos when the video finishes". Copy the Iframe tag.

You can change the width of the iframe manually.

example:

<iframe width="560" height="315" src="https://www.youtube.com/embed/xmhnNUotIaE?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>

这篇关于如何将YouTube视频添加为&lt; video&gt;而不是嵌入的&lt; iframe&gt ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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