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

sharingPlugin / relatedPlugin Undefined


Here is my code on page, which is having issues though the same code works on a small player demo page, so not sure what's happening here:

$(document).delegate('#vr_share', 'click', function(){
$( "#overlay" ).remove();
var sharingPlugin = playerInstance.getPlugin('sharing');
sharingPlugin.open();
frommenu = true;
});
$(document).delegate('#vr_related', 'click', function(){
$( "#overlay" ).remove();
var relatedPlugin = playerInstance.getPlugin('related');
relatedPlugin.open();
frommenu = true;
});

My video is definitely "playerInstance", as I have a number of functions working. I just can't get the plugin info to work. I click the button to enact either plugin and I get:

Error: TypeError: sharingPlugin is undefined

Feedback appreciated.

Cheers
Ryan

10 Community Answers

contact

User  
0 rated :

I should point out that this function follows right behind the two above:

$(document).delegate('#vr_replay', 'click', function(){
$( "#overlay" ).remove();
playerInstance.seek(0);

setTimeout(function(){ playerInstance.pause(false); }, 500);
});

And this function works great. It's something with adding the getPlugin that makes the variable undefinied.

Todd

JW Player Support Agent  
0 rated :

I do not quite follow what you’re trying to do with the .remove() and we don’t work with jQuery at all, but do you need to define playerInstance before you call getPlugin() ?

I created a small test page and it is working for me. Here’s the code I used:

<div id='demo'></div>

<br> <input type=button value=“Open Sharing” onClick=“showSharing();”>
<script type='text/javascript'>
function showSharing() {
var playerInstance = jwplayer(‘demo’);
var sharingPlugin = playerInstance.getPlugin(‘sharing’);
sharingPlugin.open();
}

jwplayer(‘demo’).setup({
file: ‘bunny.mp4’,
sharing: {
link: “http://example.com/page/345/”
}
});
</script>

contact

User  
0 rated :

Hey Todd,

I created a custom ending canvas to avoid the stop() function from being run, while also giving user access to additional functions; which require my custom overlay to be removed upon getplugin call.

You can see the result here:

http://www.traileraddict.com/jwplayer.php

If you use it, credit me. :)

But, it turns out I was idiotic and had the the sharing and related instance noted out, so it wasn't activating the plugin upon call. Got it fixed now.

Cheers
Ryan

jherrieven

User  
0 rated :

Ryan

You still have a bit of an issue with the end detection/overlay solution.

On closing the overlay the player continues to run. Do this a couple of times and the video actually completes and you get the inbuilt JW related overlay firing and the replay icon is shown.

Might not be a big issue for you but I got multiple overlays appearing when I tried it on your live site.

You also have the JW6.12 library file being loaded on your live site (as well as the JW7 library) which might account for the "Invalid Licence" issue you experienced a few days ago.

James Herrieven

===================================================
Powered by Haiku
http://powered-by-haiku.co.uk/
---------------------------------------------------
Tatami for Online Video
http://dev.powered-by-haiku.co.uk/solutions/tatami/
---------------------------------------------------
skype: JamesHerrieven
email: james[at]haiku[dot]co[dot]uk
===================================================

jherrieven

User  
0 rated :

Ryan

I've put together an example page demonstrating an alternative approach to the end detection/overlay solution which overcomes the issue described above.

It also includes a more robust "pause/seek/pause" and "play/seek/play" technique.

http://dev.powered-by-haiku.co.uk/debug/traileraddict/

James

contact

User  
0 rated :

Hey james,

Where do you see the different versions of JWPlayer being created on the live site? I can't find that.

Cheers
Ryan

contact

User  
0 rated :

And thanks for other solution. I did notice that when close player resumes for milliseconds before pauses again, causing player to approach and soon reach end/stop().

Testing your code now.

contact

User  
0 rated :

I've looked all over the pages and I can't see how I'm calling two versions of JWPlayer. This is what I have on page:

<script src="http://content.jwplatform.com/libraries/C43Zjlwr.js"></script>

jherrieven

User  
0 rated :

Hi Ryan

At the bottom of the page, just above the "mainnav.js" call, you have this:

<script src="//jwpsrv.com/library/WYTtwCauEeOSgxIxOUCPzg.js"></script>

Which is the JW6 library file.

James

contact

User  
0 rated :

Whoa! That was in our footer for sitewide, making me think one of our ad networks was having us use that. I've disabled to see if any special ads stop working.

Cheers
Ryan

This question has received the maximum number of answers.