Reputation: 17
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.
Upvotes: 0
Views: 3105
Reputation: 4288
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
Upvotes: 1