I am using React JW player.
My component
JavaScript
x
6
1
<ReactJWPlayer
2
playerId="id"
3
playerScript="https://content.jwplatform.com/libraries/xxxx.js"
4
playlist={{"My JSON"}}
5
/>
6
This is working well. I need to get the current duration of the playing video. How can I do that in reactjs?
Advertisement
Answer
You can access “raw” JW player by doing
JavaScript
1
4
1
<ReactJWPlayer playerId="id"
2
3
let playerInstance = window.jwplayer('id');
4
To get current position of JW Player do
JavaScript
1
2
1
playerInstance.getPosition();
2