将 html5 视频与 highchart.js 折线图同步
我有一个一分钟长的火车移动视频和一些关于他的位置、车载加速度计等的数据系列。
我的目标是制作那些随视频动态绘制的测量值的折线图(使用 Highcharts.js)每秒 20 点。图表必须随视频移动,这样,如果用户返回,图表也会在同一帧上移动,依此类推。
我想知道是否有一种方法可以将事件附加到视频进度条并每 x 毫秒和/或每次用户播放/停止视频时重新绘制图表
I have a one minute long video of a train moving and some data series about his position, onboard accelerometer etc.
My goal is to make line charts (with Highcharts.js) of those measurements that are dynamically drawn with the video at a rate of 20points per second. The charts have to move with the video, so that if the user go back also the charts go at the same frame and so on.
I was wondering if there's a way to attach an event to the video progress bar and redraw the chart every x milliseconds and/or every time that the user play/stop the video
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将视频元素的
timeupdate
事件与 Highcharts 系列的setData
方法连接起来就足够了。示例:
现场演示: http://jsfiddle.net/BlackLabel/8a6yvjs5/< /a>
API 参考: https://api.highcharts.com/class-reference/Highcharts.Series#setData
文档:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/currentTime
https://developer.mozilla.org/en-US/docs/ Web/API/HTMLMediaElement/timeupdate_event
Connecting
timeupdate
event for a video element withsetData
method for a Highcharts series should be enough.Example:
Live demo: http://jsfiddle.net/BlackLabel/8a6yvjs5/
API Reference: https://api.highcharts.com/class-reference/Highcharts.Series#setData
Docs:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/currentTime
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/timeupdate_event