雅虎!联网电视播放事件
我正在尝试订阅 onTimeIndexChanged
mediaplayer 事件。只要我订阅的视图保持专注,它就可以正常工作。当我按下后退按钮或小部件按钮时,我的视图变得模糊并且不再接收事件。
是否可以通过切换视图来保持这个订阅?是否有小部件范围内的订阅?
我想知道是否可以计算客户端的播放时间。
I'm trying to subscribe to onTimeIndexChanged
mediaplayer event. It works fine, as long as view that I'm subscribing in stays focused. When I press back button, or widgets button, my view gets blurred and it no longer receives events.
Is it possible for this subscription to persist through switching views? Are there widget-wide subscriptions?
I am trying to find out if it is possible to count time of playback client-side.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
雅虎上也对此做出了回答!联网电视论坛:http://developer.yahoo.net/forum/?showtopic=7383< /a>
是的,您走在正确的道路上。媒体播放器是一个单例,因此不绑定到任何特定视图。您可以定义一个监听器,在小部件的全局执行上下文中订阅它。这样,您仍然可以接收和处理视图被GC时发生的事件,并且您仍然可以接收这些事件。
我们将这些全局订阅放在 init.js 中,以便它们位于中心位置(最佳实践)。
然后,在 Javascript/core/EventHandlers.js 中:
This was also answered on the Yahoo! Connected TV forums at: http://developer.yahoo.net/forum/?showtopic=7383
Yes, you're on the right track. The media player is a singleton and as such isn't bound to any particular view. You can define a listener that subscribes to it in the widget's global execution context. This way you can still receive and handle events that happen when a view is gc'd, and you can still receive those events.
We put these global subscriptions in init.js so they're centrally-located (best practice).
Then, in Javascript/core/EventHandlers.js: