0
votes

I am having trouble stopping all existing/running players before loading new a player. Only one player should be running at once.

My site is loads a z-layer with the player in. The problem is that if I click the playlist links more than once, it loads multiple players, and even continues playing when the z-layer is closed.

All calls to the player use the same id: player1

I have looked at these references:

I have tried calling:

jwplayer("player1").stop()

before:

jwplayer("player1").setup({

and also:

onclick="jwplayer(\'player1\').stop();"

inside the playlist <a href ...> links

but neither work. What is wrong please?

Also there is a white 'flash' on loading now which was not there before I tried these stopping methods. I have tried to change the background colour for var D="#000000", as described here:

but 'var D' is not in the jwplayer.js file.

1
Where is this running?emaxsaun
Possible duplicate of pause JW player?halfer
Yes, it seems to be duplicate of stackoverflow.com/questions/22091761/pause-jw-playerHitesh

1 Answers

1
votes

Instead of using jwplayer().stop(), In case if you just want player to pause when other jwplayer is working , you can use jwplayer().pause()

for this, I mostly prefer jwplayer().play(false). but if you are trying to remove the player jwplayer().remove() will do the trick.

Source : Jwplayer API

for more information check this link for similar type of question