OSMF - 向视频添加动作脚本提示点?
我正在尝试使用 OSMF 向视频添加提示点。我构建了一个 OSMF 视频播放器,我想使用它而不是 FLVPlayback 组件,这似乎是添加动作脚本提示点的唯一方法?
无论如何,我通过编写以下内容创建了一个提示点:
var cuePoint:CuePoint = new CuePoint(CuePointType.ACTIONSCRIPT, 1, "good point", null);
videoElement.addEventListener(MediaElementEvent.METADATA_ADD, onMetadataAdd);
trace(cuePoint.time);
提示点时间追踪到“1”(成功)。
然后,我从文档中获取了这段代码,认为这将有助于在我发布电影时跟踪提示点(以测试视频)。
private function onMetadataAdd(event:MediaElementEvent):void
{
if (event.namespaceURL == CuePoint.DYNAMIC_CUEPOINTS_NAMESPACE)
{
var timelineMetadata:TimelineMetadata = videoElement.getMetadata(CuePoint.DYNAMIC_CUEPOINTS_NAMESPACE) as TimelineMetadata;
timelineMetadata.addEventListener(TimelineMetadataEvent.MARKER_TIME_REACHED, onCuePoint);
}
}
private function onCuePoint(event:TimelineMetadataEvent):void
{
var cuePoint:CuePoint = event.marker as CuePoint;
trace("Cue Point at " + cuePoint.time);
}
但是,当视频达到 1 秒时,我没有收到跟踪消息。谁能帮助我吗?
I'm trying to add a cuepoint to a video using OSMF. I built an OSMF video player, and I'd like to use this instead of the FLVPlayback component, which seems like the only way to add an actionscript cuepoint?
Anyhow, I created a cuepoint by writing this:
var cuePoint:CuePoint = new CuePoint(CuePointType.ACTIONSCRIPT, 1, "good point", null);
videoElement.addEventListener(MediaElementEvent.METADATA_ADD, onMetadataAdd);
trace(cuePoint.time);
The cuepoint time traced out to "1" (successful).
I then took this code from the documentation, thinking it would help trace the cuepoint when I published my movie (to test the video)
private function onMetadataAdd(event:MediaElementEvent):void
{
if (event.namespaceURL == CuePoint.DYNAMIC_CUEPOINTS_NAMESPACE)
{
var timelineMetadata:TimelineMetadata = videoElement.getMetadata(CuePoint.DYNAMIC_CUEPOINTS_NAMESPACE) as TimelineMetadata;
timelineMetadata.addEventListener(TimelineMetadataEvent.MARKER_TIME_REACHED, onCuePoint);
}
}
private function onCuePoint(event:TimelineMetadataEvent):void
{
var cuePoint:CuePoint = event.marker as CuePoint;
trace("Cue Point at " + cuePoint.time);
}
However, I don't get a trace message when the video hits 1 second. Can anyone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为它应该只是
private function onMetadata
。I think it should be just
private function onMetadata
.这是添加提示点的另一种更简单的方法:
基本上:
Here is another way to add cuepoints that's a little simpler:
Basically: