Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jPlayer - how to find out if it's playing

How can I find out if jPlayer is playing? I tried this alert($.jPlayer.event.playing); but it doesn't work.

like image 971
simPod Avatar asked Feb 05 '12 22:02

simPod


2 Answers

I've not worked with Jplayer specifically, but playing around, this returned false if the media was playing and true if it wasn't.

$('#jquery_jplayer_1').data().jPlayer.status.paused
like image 78
Kyle Macey Avatar answered Oct 18 '22 12:10

Kyle Macey


Kyle's method works fine, here's a fiddle to demonstrate it in action: http://jsfiddle.net/75lb/95EPu/

However, ordinarily you wouldn't need to access jPlayer's internals like this, being an event-driven plugin.. would it be cleaner to respond to one of jPlayer's many events (at the appropriate moment)? http://www.jplayer.org/latest/developer-guide/#jPlayer-events

like image 27
Lloyd Avatar answered Oct 18 '22 10:10

Lloyd