Skip to content

Instantly share code, notes, and snippets.

@dyaa
Created September 30, 2013 15:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dyaa/6765099 to your computer and use it in GitHub Desktop.
Save dyaa/6765099 to your computer and use it in GitHub Desktop.
Check if jplayer is playing
$("#jquery_jplayer_1").jPlayer({
swfPath: "http://www.jplayer.org/latest/js/Jplayer.swf",
ready: function () {
$(this).jPlayer("setMedia", { mp3: "http://77.68.106.224:8018/;stream/1" });
},
supplied: "mp3"
});
setInterval(function () {
var isPaused = $('#jquery_jplayer_1').data().jPlayer.status.paused;
$("#message").text("Is Paused: " + isPaused);
}, 1000);
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div id="jp_container_1" class="jp-audio">
<ul class="jp-controls">
<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
<li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
</ul>
<div class="jp-current-time"></div>
<div class="jp-duration"></div>
<div class="jp-no-solution">
<span>Update Required</span> To play the media you will need to either update your
browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/"
target="_blank">Flash plugin</a>.
</div>
</div>
<p id="message"></p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment