Reply
Visitor
gouegd
Posts: 4
Registered: 11-29-2011
0
Accepted Solution

JS: onTemplateReady not fired (AS/JS APIs activated)

Hi,

 

So I'm new to Brightcove and using my trial account I can't get the onTemplateReady to fire.

I activated the AS/JS APIs in the console for the player I'm using.

The video gets loaded but the callback  function won't be called... please help ?

Only difference I see with some BC examples is I don't have a providerId. I use a playerKey param instead, I think it's just the latest way to do it as I can find a providerId nowhere.

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>Player API HTML Test </title>
    <script type="text/javascript">
        function onTemplateLoaded(experienceID) {
            alert("onTemplateLoaded");
        }
    </script>
</head>
<body>
    <!-- Start of Brightcove Player -->
    <script type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>
    <script type="text/javascript" src="http://admin.brightcove.com/js/APIModules_all.js"></script>

    <div style="display:none">
    </div>
    <!--
    By use of this code snippet, I agree to the Brightcove Publisher T and C 
    found at http://corp.brightcove.com/legal/terms_publisher.cfm. 
    -->

 
    <object id="myExperience" class="BrightcoveExperience">
        <param name="bgcolor" value="#00FFFF" />
        <param name="width" value="480" />
        <param name="height" value="270" />
        <param name="playerID" value="1301163662001" />
        <param name="playerKey" value="AQ~~,AAABLI1oNrE~,4XL2HzzanPGYsblTGMtHblm3l2VkQS4a" />
        <param name="isVid" value="true" />
        <param name="isUI" value="true" />
        <param name="dynamicStreaming" value="true" />
        <param name="@videoPlayer" value="1301506734001" />
    </object>
 
    <script type="text/javascript">brightcove.createExperiences();</script>
    <!-- End of Brightcove Player -->
</body>
</html>

 Thanks for any help.

 

Brightcove Team
BC-Maverick
Posts: 33
Registered: 04-01-2011
0

Re: JS: onTemplateReady not fired (AS/JS APIs activated)

Hi Gouegd,

 

Can you elaborate more on the issue you are having.

 

I am able to see the alert being fired inside onTemplateLoaded(). 

 

For Template Ready, you will have define the function onTemplateReady(), which I do not see in your code.

Visitor
gouegd
Posts: 4
Registered: 11-29-2011
0

Re: JS: onTemplateReady not fired (AS/JS APIs activated)

[ Edited ]

Hi Maverick,

 

Sorry for mixing the function names. My problem is I don't get the alert, I'm surprised you do.

I tried on the latest Chrome & Firefox.

 

I do, however, get a Flash security popup which I have to close in order to have the video load, see below :

 

Could that be related ?

 

Update: I just tried it by putting my sample HTML page on Apache, and it's now working (with no Flash warning).

That's a problem for me however, as the project I'm working on will run locally. Would you know what is preventing the callback from being called in this case... And any way to work around this ?

 

Thanks,

Greg

 

Brightcove Team
BC-Maverick
Posts: 33
Registered: 04-01-2011

Re: JS: onTemplateReady not fired (AS/JS APIs activated)

 

Yes, you will have to provide access to *.brightcove.com in order for the API calls to work.

 

Otherwise they will not work. This is usually the case when you have files on your localhost.

 

Visitor
gouegd
Posts: 4
Registered: 11-29-2011
0

Re: JS: onTemplateReady not fired (AS/JS APIs activated)

Yep worked fine this way.

Thanks a lot ! :)