简体   繁体   English

如何添加一个 eventListener 以从 JWPlayer 获取事件数据

[英]How to add an eventListener to get event data from JWPlayer

I don't understanding what code is needed to simply output any interaction with the Flash JW Player.我不明白简单地输出与 Flash JW Player 的任何交互需要什么代码。 Below is a code demo from their documentation (results in addControllerListener being undefined).下面是他们文档中的代码演示(导致 addControllerListener 未定义)。 Some more details in the JW Player Flash API . JW Player Flash API中的更多详细信息。

function muteTracker(obj) { alert('the new mute state is: '+obj.state); };
player.addControllerListener("MUTE","muteTracker");

I want to extend this to include functions to track all other interactions such as play, seek, fullscreen etc.我想扩展它以包括跟踪所有其他交互的功能,例如播放、搜索、全屏等。

You were on the right track!你走在正确的轨道上! If you check out the player API , you'll notice that there are three methods for adding listeners:如果查看播放器 API ,您会注意到添加侦听器的方法有以下三种:

  • player.addControllerListener(EVENT,myFunction); player.addControllerListener(EVENT,myFunction);
  • player.addModelListener(EVENT,myFunction); player.addModelListener(EVENT,myFunction);
  • player.addViewListener(EVENT,myFunction); player.addViewListener(EVENT,myFunction);

Pair that with the events list ( http://developer.longtailvideo.com/trac/wiki/Player4Events ) and you're good to go.将其与事件列表 ( http://developer.longtailvideo.com/trac/wiki/Player4Events ) 配对,你就可以开始了。 Thus, if you're looking to listen for seek events, it would look something like:因此,如果您正在寻找侦听搜索事件,它看起来像:

player.addViewListener(ViewEvent.PLAY,myFunction);

or for seek,或寻找,

player.addViewListener(ViewEvent.SEEK,myFunction);

Best,最好,

Zach扎克

Developer, LongTail Video开发者,长尾视频

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM