【发布时间】:2012-10-28 00:02:12
【问题描述】:
我正在建立一个网站,但对此并不陌生。我正在尝试做的是在网站中嵌入一个 youtube 视频,一旦视频结束,它会在网站上显示其他内容,在我的情况下是用户可以输入单词的 editText。
我不在乎 editText 是否出现在视频所在的位置或视频的正下方或类似的任何内容..
我发现了如下几点:
how to display lightbox after Video Play Finishes?
但是什么都没发生
也试过这段代码
<html>
<head>
<script type="text/javascript" src="public/javascripts/swfobject.js"></script>
</head>
<body>
<div id="ytapiplayer">
You will need Flash 8 or better to view this content.
</div>
<script type="text/javascript">
var params = { allowScriptAccess: "always" };
var atts = { id: "ytplayer" };
swfobject.embedSWF("http://www.youtube.com/v/OQSNhk5ICTI&enablejsapi=1&playerapiid=ytplayer", "ytapiplayer", "425", "365", "8", null, null, params, atts);
function onYouTubePlayerReady(playerId) {
alert('Player loaded');
ytplayer = document.getElementById("ytplayer");
}
function play() {
alert(typeof ytplayer);
if (ytplayer) {
alert(ytplayer.playVideo);
ytplayer.playVideo();
}
}
</script>
<a href="javascript:void(0);" onclick="play();">Play</a>
</body>
</html>
但我没有看到视频出现。如果我点击播放,我会收到一条消息说“未定义”
【问题讨论】: