javascript - Brightcove 视频模板加载处理程序未触发

标签 javascript events brightcove

好吧,整个下午我都在为 BrightCove API 苦苦挣扎,我真的不知道哪里出了问题。

我遵循了 Brightcove 提供的所有内容,并为智能播放器启用了 javascript api。但是 templateLoadHandler 只是没有触发。这真的让我发疯!

这是我的代码

<!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>

如果触发事件,则会显示警报。但从来没有... 任何人都知道为什么它不工作?谢谢。

最佳答案

我在没有包含 jquery 和 jBrightcove.js 的情况下运行了您的代码(因为我没有它们)。它运作良好。如果它不适合您,我猜想 jBrightcove.js 脚本中的某些内容与您此处的代码之间存在冲突。

关于javascript - Brightcove 视频模板加载处理程序未触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10815086/

相关文章:

javascript - ReactJS:TypeError:无法添加/删除密封的数组元素

javascript - 为什么来自 index.js 的实现的动态部分不起作用?

javascript - 在javascript中获取节点的所有子节点

wpf - 使用 MVVM 从事件触发动画

c# - WPF MVVM 中将 frameworkElement 事件绑定(bind)到 View 模型处理程序的 "proper"方法是什么?

javascript - 当 Div 可见时 Brightcove 开始播放

javascript - 使用 .map() 为 JS 对象添加增量值

javascript - Brightcove HTML5风格定制

Brightcove 视频缩略图

Angular2,HostListener,我如何定位一个元素?我可以根据类(class)定位吗?