我整个下午都在为BrightCove应用编程接口而苦苦挣扎,我真的不知道哪里出了问题。
我遵循了Brightcove给出的所有内容,并为智能播放器启用了javascript api。但templateLoadHandler就是不能启动。这真的让我发疯!
这是我的代码
<!doctype html>
<html>
<head>
<title>Brightcove video API demo</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="jBrightCove.js"></script>
</head>
<body>
<h2>Brightcove Video Cloud Demo</h2>
<!-- Start of Brightcove Player -->
<div style="display:none">
</div>
<!--
By use of this code snippet, I agree to the Brightcove Publisher T and C
found at https://accounts.brightcove.com/en/terms-and-conditions/.
-->
<script language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>
<object id="myExperience1655503405001" class="BrightcoveExperience">
<param name="bgcolor" value="#FFFFFF" />
<param name="width" value="480" />
<param name="height" value="270" />
<param name="playerID" value="1655260200001" />
<param name="playerKey" value="AQ~~,AAABgXJq-HE~,N7Kwgwyc9ubOnOKgNwEM8Jm-tJbp_nzt" />
<param name="isVid" value="true" />
<param name="isUI" value="true" />
<param name="dynamicStreaming" value="true" />
<param name="@videoPlayer" value="ref:spring" />
<param name="includeAPI" value="true" />
<param name="templateLoadHandler" value="myTemplateLoaded" />
</object>
<script type="text/javascript">
// this piece of code is from BrightCove template
var player;
var modVP;
var modExp;
var modCon;
////
//
function myTemplateLoaded(experienceID) {
alert("123");
player = brightcove.api.getExperience(experienceID);
modVP = player.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER);
modExp = player.getModule(brightcove.api.modules.APIModules.EXPERIENCE);
modCon = player.getModule(brightcove.api.modules.APIModules.CONTENT);
}
</script>
</body>
</html>如果该事件被触发,则会显示一个警报。但从来没有..。有人知道它为什么不工作吗?谢谢。
发布于 2012-05-31 22:58:12
我在运行您的代码时没有使用jquery和jBrightcove.js包含(因为我没有它们)。它工作得很好。如果它对您不起作用,我猜可能是jBrightcove.js脚本中的某些内容与此处的代码发生了冲突。
发布于 2012-07-02 20:22:29
您是否尝试过将处理程序移至HTML代码之上?这对我很管用。另外,我必须将"crossdomain.xml“文件添加到我的web服务器根目录中,这样它才能工作。您可能不需要它,但包含它以防万一。
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
<!-- Most restrictive policy: -->
<allow-access-from domain="admin.brightcove.com"/>
<!-- Least restrictive policy: -->
<!--
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
-->
<!--
If you host a crossdomain.xml file with allow-access-from domain="*"
and don’t understand all of the points described here, you probably
have a nasty security vulnerability. ~ simon willison
-->
</cross-domain-policy>发布于 2013-05-23 03:39:30
在这种情况下,Alex似乎有错误的帐户类型。对我来说情况并非如此。我在brightcove论坛上发现需要从run服务器运行代码。在我将来自该站点的代码添加到我本地的XAMPP安装之后,它就像广告中所说的那样工作了。这是我找到信息的URL:
http://forum.brightcove.com/t5/Media-APIs/templateLoadHandler-not-fired/td-p/19585
https://stackoverflow.com/questions/10815086
复制相似问题