well, I was struggling with the BrightCove API for the whole afternoon, and I really don't what went wrong.
I followed all Brightcove gives, and enabled the javascript api for smart player. But the templateLoadHandler is just not firing. It is really makes me crazy!
This is my code
<!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>
If the event is fired, then an alert would show. But never... Anyone knows why it is not working? Thanks.
I ran your code without the jquery and jBrightcove.js includes (since I don't have them). It worked fine. If it's not working for you, I would guess there's a collision between something in the jBrightcove.js script and your code here.