Reply
New Member
Bigbacon
Posts: 2
Registered: ‎03-28-2012
0 Kudos

API functions do not seem to work.

Just got thrown into a project that needs to embed videos from my company's BrightCove account.

 

Using the test accout I have, I was able to upload a video, copy the publish code, and have it run on my ASPX page.

 

After that, nothing seems to work. Trying to use the API calls just never seems to do anything.

 

The js files are being loaded, for good measure I added *.brightcove to my trusted sites and such just to make sure but it is almost like it just gets ignored.

 

Fearing it was a strange asp.net issue I built a basic HTM page and still nothing. I am mainly trying to use the API to capture the fact that the video ended and maybe just keep track of where the video is so a user could restart where they left off.

 

<html>
    <head>
    <script type="text/javascript">

        var player;
        var video, content, exp, menu, ads, social;
        var videoList;

        function onTemplateLoaded(experienceID) {
            alert("onTemplateLoaded");

            video = player.getModule(APIModules.VIDEO_PLAYER);
            exp = player.getModule(APIModules.EXPERIENCE);

            exp.addEventListener(BCExperienceEvent.TEMPLATE_READY, onTemplateReady);
            video.addEventListener(BCVideoEvent.VIDEO_COMPLETE, onVideoComplete);

        }
        function onTemplateReady(e) {
            alert("onTemplateReady");
        }

        function onVideoComplete(e) {
            alert("onVideoComplete")
        }
</script>
    </head>
    <body>

    <!-- 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>
<script type="text/javascript" src="http://admin.brightcove.com/js/APIModules_all.js"></script>

<object id="myExperience1533035056001" class="BrightcoveExperience">
  <param name="bgcolor" value="#FFFFFF" />
  <param name="width" value="480" />
  <param name="height" value="270" />
  <param name="playerID" value="1386786377001" />
  <param name="playerKey" value="AQ~~,AAABQuUYCTk~,-ndnvKvL5fyVXxLM_ehPKEv0p4cxoSeV" />
  <param name="isVid" value="true" />
  <param name="isUI" value="true" />
  <param name="@videoPlayer" value="1533035056001" />
</object>

<!-- 
This script tag will cause the Brightcove Players defined above it to be created as soon
as the line is read by the browser. If you wish to have the player instantiated only after
the rest of the HTML is processed and the page load is complete, remove the line.
-->
<script type="text/javascript">

    brightcove.createExperiences();


</script>

<!-- End of Brightcove Player -->
    </body>
</html>

 

 

 What am I missing? Probably something very silly.

New Member
Bigbacon
Posts: 2
Registered: ‎03-28-2012
0 Kudos

Re: API functions do not seem to work.

I am using the basic Chromeless player if that helps. I don't seem to be able to change it or even know if it publishes using the API checked option. I suspect this is my issue.

Brightcove Team
BC-Jonathan
Posts: 235
Registered: ‎09-30-2011
0 Kudos

Re: API functions do not seem to work.

Hello,

 

Have you double checked that within the Player Settings you have enabled APIs?

 

Thanks

Brightcove Team
BC-Oscar
Posts: 503
Registered: ‎12-11-2008
0 Kudos

Re: API functions do not seem to work.

It sounds like you haven't turned on the API for this player in the Publishing module.