04-11-2012 04:48 AM
Hi there,
I have been setting up a simple video example the last few days and things were working fine, now moving into the smart API, I have been running up against some issues. Looking over forum and websites there seems to be a variety of methods for embedding. heres what Im doing.
<script language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperienc
<script language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/APIModules.js"></script>
<script type="text/javascript">
var player;
var modExp;
var modVid;
var modCue;
var modCon;
function myTemplateLoaded(experienceID) {
console.log("1");
// get main BC experience
player = brightcove.getExperience(experienceID);
// get BC modules
modExp = player.getModule(APIModules.EXPERIENCE);
modVid = player.getModule(APIModules.VIDEO_PLAYER);
modCue = player.getModule(APIModules.CUE_POINTS);
modCon = player.getModule(APIModules.CONTENT);
modExp.addEventListener(BCExperienceEvent.TEMPLATE
modExp.addEventListener(BCExperienceEvent.CONTENT_
console.log("2");
function onTemplateReady(event) {
console.log("onTemplateReady");
}
function onContentLoad(event) {
console.log("onContentLoad");
}
}
</script>
Then I have the usual embed code as follows..
<object id="myExperience1543793011001" class="BrightcoveExperience">
<param name="bgcolor" value="#FFFFFF" />
<param name="width" value="480" />
<param name="height" value="270" />
<param name="playerID" value="1543801259001" />
<param name="playerKey" value="AQ~~,AAABZ2UOerk~,JiwdNLbJuAK8fyuDHPfmW_w9G
<param name="isVid" value="true" />
<param name="isUI" value="true" />
<param name="dynamicStreaming" value="true" />
<param name="includeAPI" value="true" />
<param name="templateLoadHandler" value="myTemplateLoaded" />
<!-- <param name="@videoPlayer" value="1543793011001" /> -->
</object>
<script type="text/javascript">brightcove.createExperience
So I get the "1" in the console but the "2" will not write out. If i remove the two event listeners the "2" will write to the log.
So my questions are:
1) Is my syntax corect for the event listeners? If yes, then is there any indication as to why they are not working ?
2) What is the significance of the number in "<object id="myExperience1543793011001". I see examples on the BC site that do not use the number and some that do. When gettignt he quick publish code the number is included. I assume is a video id. If I remove the number i get the experince not found error in the console. Is this number required ?
3) If this is required and must be related to the video ID a specfiic video in my BC account, I repsume I can load additional videos into this experience wheile the user is on the page ? (eg from custom playlist)
4) Canyou clairfy which is the prefereed method for accessing Objects, should I be referencing modules directly or through their package path? eg modExp = player.getModule(APIModules.EXPERIENCE); vs modExp = player.getModule(brightcove.api.modules.APIModules
Thanks in advance for any assistance.
J
04-11-2012 10:14 AM
Here are some answers:
1. Try removing this line: <script language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/APIModules.js"></script>.
It might be conflicting with the smartplayer api js file that gets loaded on runtime.
2. You just any string there so there is an id for the object tag. The API uses this id to create a namespace for this id. It is useful for cases where you have multiple players in a page and want to get a reference to a specific one by id. It is not linked to any id in the Brightcove system
3. @videoPlayer is really the video id parameter. This should be a video id in your account. You can load new videos by callign the loadVideo or cueVideo APIs.
4. This is a good article with code samples on how to use the smart player api, including best practices. http://support.brightcove.com/en/docs/preparing-pl
04-11-2012 07:00 PM
Thanks for your answers.
I removed the APIModules.js include, bbut got erros. So I added the complete package path to the getModule calls eg:
modVid = bcExp.getModule(brightcove.api.modules.APIModules.
as opposed to
modVid = bcExp.getModule(APIModules.VIDEO_PLAYER);
And I also noticed I was trying to use an event (brightcove.api.events.BCExperienceEvent.TEMPLATE_
Thanks for your help again.
J
Brightcove Inc., a leading global provider of cloud content services, provides a family of products used to publish and distribute the world's professional digital media. The company's products include Brightcove Video Cloud, the market-leading online video platform, and Brightcove App Cloud, the pioneering content app platform. Together, more than 4,200 customers in 50 countries rely on Brightcove's cloud content services to build and operate exceptional media experiences across PCs, smartphones, tablets and connected TVs.
Brightcove Inc.
© 2012 Brightcove Inc.
