javascript 使用 jwplayer 获取当前播放时间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10597600/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
use jwplayer to get current play time
提问by wumengjun
I am using jwplayerto play embedded video, the javascript apitells me
我正在使用jwplayer播放嵌入式视频,javascript api告诉我
jwplayer("mediaplayer").getPosition()
jwplayer("mediaplayer").getPosition()
will get the current position, but my result is undefined
将获得当前位置,但我的结果是 undefined
Can anyone help me get the correct resilts
谁能帮我得到正确的resilts
回答by Manse
Works fine for mejust how the documentation specifies :
文档如何指定对我来说很好用:
<div id="container"></div>
jwplayer("container").setup({
file: "http://content.bitsontherun.com/videos/nPripu9l-60830.mp4",
flashplayer: "http://player.longtailvideo.com/player.swf",
image: "http://content.bitsontherun.com/thumbs/nPripu9l-480.jpg",
height: 270,
width: 480
});
var state = jwplayer("container").getState();
var elapsed = jwplayer("container").getPosition();
回答by Richard
How does your HTML and JavaScript look? Without seeing these, I can only assume the following.
你的 HTML 和 JavaScript 看起来如何?没有看到这些,我只能假设以下。
According to the API documentationon the website this can be achieved without specifying a container, like so...
根据网站上的API 文档,这可以在不指定容器的情况下实现,就像这样......
jwplayer().getPosition()