我希望能够显示带有重叠注释的普通 YouTube 视频,其中每个帧都包含彩色矩形。唯一的要求是这应该以编程方式完成。
YouTube 现在有注释,但要求您使用其前端手动创建它们。我希望能够生成它们。最好的方法是什么?
一些想法:
- Build your own Flash player (ew?)
- Somehow draw over the YouTube Flash player. Will this work?
- Reverse engineer & hijack YouTube's annotation system. Either messing with the local files or redirecting its attempt to download the annotations. (using Greasemonkey? Firefox plugin?)
不重要的想法:
download the video
最佳答案
YouTube 提供 ActionScript API .
使用此功能,您可以使用其 API 将视频加载到 Flash 中,然后让您的 Flash 应用程序在视频上方的图层上创建注释。
或者,如果您不想在 Flash 中创建某些内容,则可以使用 YouTube 的 JavaScript API 在网页上的 YouTube 播放器上绘制 HTML DIV。请记住,当您嵌入播放器时,参数列表中应包含 WMODE="transparent"
。
因此使用 YouTube 中的示例:
<script type="text/javascript">
var params = { allowScriptAccess: "always" };
var atts = { id: "myytplayer", wmode: "transparent" };
swfobject.embedSWF("http://www.youtube.com/v/VIDEO_ID&enablejsapi=1&playerapiid=ytplayer",
"ytapiplayer", "425", "356", "8", null, null, params, atts);
</script>
然后您应该能够使用 CSS/DHTML 在 YouTube 电影上绘制注释。
关于youtube - 以编程方式注释 YouTube 视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/175/