Yan
Yan

Reputation: 592

JWPlayer .onError triggered when page is refreshed

I have a .onError function on my player, which by itself is fine. However, the problem is when the page is refreshed (user action) the .onError action fired, any way to avoid it?

Upvotes: 1

Views: 538

Answers (1)

emaxsaun
emaxsaun

Reputation: 4201

Just add this under your player's closing <script> tag:

<script>
window.onbeforeunload = stopPlayers;
function stopPlayers(){
     jwplayer().stop(true);
}
</script>

Upvotes: 1

Related Questions