1

我正在尝试找到一种通过 Brightcove 在我的媒体 api 上访问视频发布代码的方法,就像您可以在云工作室上为下面这样的播放器获取的方法一样。

<!-- 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="myExperience" class="BrightcoveExperience">
<param name="bgcolor" value="#FFFFFF" />
<param name="width" value="960" />
<param name="height" value="445" />
<param name="playerID" value="2164048951001" />
<param name="playerKey" value="AQ~~,AAABzJDWv4k~,nrw5-YJoyhvZYIpODobX62cNFZVSM1ri" />
<param name="isVid" value="true" />
<param name="isUI" value="true" />
<param name="dynamicStreaming" value="true" />

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

我想在我的 api 的视频元数据部分中将此作为选项,有没有人有任何建议从哪里开始。谢谢。

4

1 回答 1

3

我不确定您是否可以通过 BC API 收集资产的发布代码,但这不是必需的。您可以做的是使用变量来替换该片段中唯一可能更改的项目 - 主要是 playerID 和 playerKey 以及 videoPlayer 值(这将指示要使用哪个播放器以及要插入哪个视频),还有可能的宽度和高度设置。

假设您希望动态换出视频(假设您将始终使用相同的播放器),您可以执行以下操作:

function get_player($video_id){
$player = '<script language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>    
<object id="myExperience" class="BrightcoveExperience">
<param name="bgcolor" value="#FFFFFF" />
<param name="width" value="960" />
<param name="height" value="445" />
<param name="playerID" value="2164048951001" />
<param name="playerKey" value="AQ~~,AAABzJDWv4k~,nrw5-YJoyhvZYIpODobX62cNFZVSM1ri" />
<param name="isVid" value="true" />
<param name="isUI" value="true" />
<param name="dynamicStreaming" value="true" />
<param name="@videoPlayer" value="'.$video_id.'" />
</object><script type="text/javascript">brightcove.createExperiences();</script>';
return $player;
}

然后只需使用要在此播放器中显示的视频的 id 调用该函数。这同样适用于更换球员和体型。

echo get_player('my_video_id');

@videoPlayer 参数告诉播放器要加载哪个视频。该文档可能会有所帮助。

于 2013-02-16T16:03:11.300 回答