我正在建立一个视频网站,我希望我的用户能够从 Youtube 上传或嵌入视频.Youtube API 似乎不提供从他们的网站上传视频,是吗?所以我尝试通过 iframe 使用 PHP 嵌入视频.代码如下:
I'm building a video website and I want my users to be able to upload or embed videos from Youtube. The Youtube API doesn't seem to provide video upload from their website, or do they?
So I tried to embed videos via an iframe with PHP. Here is the code:
<?php
$source=$_POST['source'];
?>
<html>
<div id="bo"><?php echo $source;?></div>
<form action="altupload.php" method="post">
<input type="text" name="source">
<input type="submit">
</form>
</html>
但我得到的是:
<html><div id="bo"><iframe width="560" height="315" src="http://www.youtube.com/embed/tZa5hyb0_wA" frameborder="0" allowfullscreen></iframe></div>`
<html>
<form action="altupload.php" method="post">
<input type="text" name="source">
<input type="submit">
</form>
</html>
谁能推荐一些其他的方法来做到这一点?谢谢
Can anyone recommend some other ways to do it? Thanks
允许用户仅上传来自 URL 的 youtube 视频 ID 为:
Allow the user upload only youtube video ID from URL as :
http://www.youtube.com/watch?v=Vw5FDZRGTL0
视频 ID:Vw5FDZRGTL0
你可以设置IFrame标签的其他选项:
and you can set other options of IFrame tag :
<iframe width="420" height="315" src="http://www.youtube.com/embed/<?php echo $videoID; ?>" frameborder="0" allowfullscreen></iframe>
祝你好运
这篇关于嵌入 Youtube 视频的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
不能使用 'Object 作为类名,因为它是保留的Cannot use #39;Object as class name as it is reserved Cake 2.2.x(不能使用 Object 作为类名,因为它是保留的 Cake 2.2.x)
OAuth 重定向后会话丢失Session is lost after an OAuth redirect(OAuth 重定向后会话丢失)
Cakephp 3.x 中的分页排序Pagination Sort in Cakephp 3.x(Cakephp 3.x 中的分页排序)
CakePHP 多个应用程序的共享核心CakePHP Shared core for multiple apps(CakePHP 多个应用程序的共享核心)
在 CakePHP 3 上登录 [ Auth->identify() ] 始终为 falLogin [ Auth-gt;identify() ] always false on CakePHP 3(在 CakePHP 3 上登录 [ Auth-identify() ] 始终为 false)
致命错误:允许的内存大小为 134217728 字节已用尽Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)(致命错误:允许的内存大小为 134217728 字节已用尽