好吧,我整个下午都在为 BrightCove API 苦苦挣扎,我真的不知道出了什么问题。
我遵循了 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>
如果事件被触发,则会显示警报。但从来没有......任何人都知道它为什么不工作?谢谢。