跟踪从自定义 HTML5 视频播放器到 Omniture 媒体模块的视频里程碑?
我有一个移动 Javascript 应用程序,它偶尔会在屏幕上动态创建 元素。我需要使用 Omniture 跟踪视频播放。我已将
play
、pause
、ending
、seeking
和 seeked
事件绑定到跟踪用户开始视频、暂停、恢复和停止(或者他们完成观看视频)。这都是通过诸如
s.Media.play("some_video_name", timePosition);
和
s.Media.stop("some_video_name");
等调用来实现的。目前这一切都有效。
我现在想做的是使用 trackMilestones
选项跟踪 0、25、75 和 100% 的位置里程碑,但我不明白我在网上找到的任何示例是如何实现的实际上通知 Omniture s.Media
对象它们所在的位置。 Omniture 无法神奇地知道我的视频在哪里,除非它将事件处理程序附加到我的视频元素。他们就是这么做的吗?
当我的播放器正在播放视频时,是否有某种方法可以调用 s.Media 对象来通知它我的位置?
I've got a mobile Javascript application that occasionally dynamically-creates a <video>
element on the screen. I need to track video plays with Omniture. I have bound the play
, pause
, ended
, seeking
and seeked
events to track that the user started a video, paused, resumed, and stopped (or that they completed viewing the video). This is all implemented with calls like
s.Media.play("some_video_name", timePosition);
and
s.Media.stop("some_video_name");
Etc. This all currently works.
What I want to now do is track the positional milestones of 0, 25, 75, and 100%, with the trackMilestones
option, but I don't understand how any of the examples I've found online actually inform the Omniture s.Media
object of where they are. Omniture wouldn't be able to magically know where my video is unless it attaches event handlers to my video element. Is that what they're doing?
Is there some method I can call on the s.Media
object to inform it of my position as my player is playing video?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
下面是一个跟踪 1/4 里程碑 (25,50,75,100) 的工作示例。
1.确保您的
s_code.js
文件中有以下内容s_code 中也需要媒体模块。以下是您需要的内容的摘录
2.将 HTML5 视频播放器绑定到 Omniture
Here is a working example that tracks 1/4 milestones (25,50,75,100).
1.Ensure you have the following in your
s_code.js
fileMedia module is required within s_code as well. Here's an excerpt of what you'll need
2.Bind HTML5 video player to Omniture
您似乎错过了通知 s.Media 持续时间的呼叫:
这与播放/暂停/搜索事件相结合,应该让他们知道视频在总播放量中所占百分比的大致位置。
我说大约是因为我怀疑他们基本上是在运行自己的内部秒表,该秒表仍然可能会偏离视频播放头。例如,在 HTML5 视频中,除了暂停之外,您还需要捕获“等待”事件。秒表将假定实时播放速率,并且不处理视频可以播放但不能及时前进的其他非事件触发原因(浏览器可能会由于视频已经在页面中的其他位置播放而拒绝播放/地点 )。想必他们的秒表足以满足他们的追踪目的。
You seem to be missing a call which informs s.Media of the duration:
This, in combination with the play/pause/seek events, should let them know approximately where the video is as a percent of total playback.
I say approximately because I suspect they're basically running their own internal stopwatch which can still drift from the video playhead. For example,in HTML5 video you'd need to catch the "waiting" event in addition to pause. The stopwatch would assume a real-time playback rate, and not handle other, non-event firing reasons why a video can be playing but not advancing in time (the browser could refuse to play due to a video already playing elsewhere in the page/site ). Presumably their stopwatch is good enough for their tracking purposes.
我不确定您是否已经找到解决方案。但要跟踪里程碑,您可以在代码的媒体监视器代码中添加以下代码。
I am not sure whether you already figured out the solution for this. But to trackMilestone's you can add the following piece of code in your scode's Media monitor code.