Reputation: 33
I would like to know how to detect when the videoPlayer is loaded. Basically I want to hide the selector that includes the videoPlayer and show it when the player is loaded...
I've tried this..
$(playerIDDiv).append('<div id="playerH" style="display:none"><object id="homesPlayer" class="BrightcoveExperience"><param name="bgcolor" value="#000" /><param name="width" value="480" /><param name="height" value="333" /><param name="playerID" value="'+playerID+'" /><param name="playerKey" value="'+playerKey+'" /><param name="isVid" value="true" /><param name="isUI" value="true" /><param name="dynamicStreaming" value="true" /><param name="wmode" value="opaque" /><param name="templateLoadHandler" value="myTemplateLoaded"><param name="includeAPI" value="true" /></object></div>');
brightcove.createExperiences();
function myTemplateLoaded(experienceID) {
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);
modExp.addEventListener(brightcove.api.events.ExperienceEvent.TEMPLATE_READY, onTemplateReady);
}
function onTemplateReady(evt) {
$('#playerH').show('slow');
}
It doesn't work at all
Upvotes: 0
Views: 2540
Reputation: 677
The first thing I notice is that you don't call the brightcove scripts:
<script language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>
or
<script language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/APIModules_all.js">
Try adding this in. And you can check the documentation for more help here. Also, I believe you need to check your player in the video cloud to be sure that your web settings has "Enable ActionScript/JavaScript APIs" checked.
Upvotes: 1