HTTP Live Streaming:如何在iOS8中使用Javascript监听作为ID3标签嵌入的定时元数据? [英] HTTP Live Streaming: how to listen for timed metadata embedded as ID3 tags using Javascript in iOS8?

查看:226
本文介绍了HTTP Live Streaming:如何在iOS8中使用Javascript监听作为ID3标签嵌入的定时元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个视频流平台,用户可以在其中播放实时视频流并将其与一组演示幻灯片同步。要在iOS上显示广播,我们正在使用HTTP Live Streaming。为了在iOS上的流中正确显示幻灯片,我们正在收听Apple的Quicktime Javascript API提供的 qt_timedmetadataupdated 事件。这里描述了这种方法:

We have a video streaming platform where users can broadcast a live video stream and synchronise it with a set of presentation slides. To display the broadcast on iOS we are using HTTP Live Streaming. In order to show the slide at the correct time in the stream on iOS we were listening for the qt_timedmetadataupdated event provided by Apple's Quicktime Javascript API. This method is described here:

http://www.wowza.com/forums/content.php?355-How-to- debug-timed-data-events-%28ID3-tags%29-from-Apple-HLS-streams-in-iOS-devices

但是,在iOS8此方法不再有效,因此我们正在尝试寻找替代解决方案。

However, in iOS8 this method no longer works so we are trying to find an alternative solution.

有没有人知道我们如何做到这一点?

Does anyone have an idea as to how we could do this?

我设法取得的唯一进展是检查带内元数据文本轨道,如下所述:

The only bit of progress I've managed to make is checking for an "in-band metadata text track" as described here:

https://github.com/videojs/videojs-contrib-hls#in-band-metadata

我使用flowplayer和 flashls插件

I've set up an example test page below using flowplayer and the flashls plugin:

http://jsbin.com/vohicoxegi/1/edit?html,js,output

In代码我创建了一个间隔,每隔500毫秒检查一个文本轨道是否存在其属性是元数据。我注意到当向流中注入一些定时元数据时,会创建其中一个文本轨道。但问题是,我无法访问定时元数据中的数据,我需要正确地同步(前面提到的)幻灯片。

In the code I've created an interval that checks every 500ms whether a text track exists whose kind property is metadata. I've noticed that when a bit of timed metadata is injected into the stream then one of these text tracks is created. But the problem is that there is no way for me to access the data that is in the timed metadata which I need to synchronise the (previously mentioned) slides correctly.

请注意,我只关注直播。播放现有的媒体文件不是问题。

Please note that I'm only concerned with live streaming. Playing an existing media file is not a problem.

推荐答案

Iron Mike的解决方案几乎是正确的。当跟踪事件发生时,您必须将其模式属性设置为隐藏否则 cuechange 事件不会触发。这是一个完整的例子:

Iron Mike's solution was nearly correct. When a track event comes through you have to set its mode property to hidden otherwise the cuechange events won't fire. Here's a full example:

$(videoElement)[0].textTracks.addEventListener('addtrack', function(addTrackEvent) {
  var track = addTrackEvent.track;
  track.mode = 'hidden';

  track.addEventListener('cuechange', function(cueChangeEvent) {
    // do what you want with the cueChangeEvent
  });
});

这篇关于HTTP Live Streaming:如何在iOS8中使用Javascript监听作为ID3标签嵌入的定时元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆