Use jwplayer to get current play time

I use jwplayer to play embedded video, javascript api tells me

jwplayer("mediaplayer").getPosition()

will get the current position but my result is undefined

Can someone help me get the right kickbacks

+4
source share
2 answers

works fine for me as stated in the documentation:

 <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(); 
+4
source

What does your HTML and JavaScript look like? Without seeing them, I can only assume the following.

According to the API documentation on the website, this can be achieved without specifying a container, e.g. ...

 jwplayer().getPosition() 
+2
source

Source: https://habr.com/ru/post/1412526/


All Articles