2016-08-18 95 views
0

我正在嘗試使用JavaScript API來嵌入使用視頻ID的視頻。 經過幾次探索之後,我發現了這樣做的方法,我想確定這是否是正確的使用方式,或者是否有我失蹤的任何東西?使用JavaScript API嵌入的Brightcove視頻

此代碼工作正常,但需要知道我是否以錯誤的方式進行操作。

<script language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script> 

    <object class="BrightcoveExperience"> 
     <param name="bgcolor" value="#FFFFFF" /> 
     <param name="width" value="480" /> 
     <param name="height" value="270" /> 
     <param name="playerID" value="4942277584001" /> 
     <param name="playerKey" value="AQ~~,AAAEfriyQEE~,ZL37ulQzt-toqcwK_Cwr35Bl9P3znlYu" /> 
     <param name="isVid" value="true" /> 
     <param name="isUI" value="true" /> 
     <param name="dynamicStreaming" value="true" /> 
     <param name="@videoPlayer" value="5072209967002" /> 
    </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> 
<script type="text/JavaScript"> 
    var player, 
    APIModules, 
    videoPlayer; 
    function onTemplateLoad(experienceID){ 
    player = brightcove.api.getExperience(experienceID); 
    APIModules = brightcove.api.modules.APIModules; 
    } 
    function onTemplateReady(evt){ 
    videoPlayer = player.getModule(APIModules.VIDEO_PLAYER); 
    videoPlayer.play(); 
    } 
</script> 
<!-- End of Brightcove Player --> 

回答

1

Brightcove播放器用於播放brightcove視頻。您編寫的代碼是正確的,但它在Brightcove文檔中顯示它使用傳統播放器。如在http://docs.brightcove.com/en/video-cloud/brightcove-player/guides/embed-in-page.html指定使用具有嵌入代碼的Brightcove的的推薦/電流的方法是:

<video data-video-id="4784463159001" 
     data-account="1507807800001" 
     data-player="SkSyF9Cl" 
     data-embed="default" 
     class="video-js" 
     controls></video> 
<script src="//players.brightcove.net/1507807800001/SkSyF9Cl_default/index.min.js"></script> 

其中視頻ID在數據視頻-id屬性和帳戶id指定在數據帳戶和玩家細節DATA-球員屬性。

欲瞭解有關如何使用帶有JavaScript的嵌入代碼的更多信息,你可以通過上述指定的鏈接。

注意:還請用您的帳戶ID和播放器密鑰詳細信息替換腳本src鏈接。

希望它有幫助。