Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Social Sharing Overlay- On Click Event, trouble


Hi, I would like a javascript function to run when a user clicks on the Social Sharing overlay button. Is this possible?

I have tried targeting it through DOM, Ex:

document.getElementByClassName('jw-dock-button')[0].onclick = closebutton;

And Also tried the JW Player Sharing API EX:


sharingPlugin.on('open', function(event)) {

closebutton();

}

Have gotten no luck with these. Any suggestion on what is the best way to do this?

2 Community Answers

Alex

JW Player Support Agent  
0 rated :

Hi, there.

Are you wrapping your sharingPlugin code in a .on(“ready”) event? In order to work properly, your code should resemble the following example.

playerInstance.on("ready", function() {
  var sharingPlugin = playerInstance.getPlugin("sharing");

  sharingPlugin.on("open", function() {
    alert("The sharing overlay has been opened.");
  });
});

You can see an example of this working on this page. Please let me know if you need any more help or have any other questions.

Thank you!

a...

User  
1 rated :

Wrapping sharingPlugin code in a .on(“ready”) event work nicely. Thanks!

I have 2 other question.

Q1: The Social Sharing Button appears above the 'logo' on the top right. Is there a way to simple way to changes the positioning like the logo in playerInstance.setup ?

Q2: I have created a div to appear above the video on pause and on complete. I used player events and CSS 'display' to do this.
However when i enter fullscreen mode with the video player, the div will not come through. I assume full screen mode ignores the rest of the page elements. How can I allow an div to come through fullscreen, with the video when use click the fullscreen button?

This question has received the maximum number of answers.