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

code doesn't work, what am i doing wrong?


Hello,
i'm trying to host jwplayer on the site,
i got the basic code with url of the player and licence key and put it on the header of the page

​<script src="mysite/jwplayer-7.2.4/jwplayer.js"></script>
<script>jwplayer.key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";</script>


then i put the code on the page with Low def and hi def videos, logo and image, but it doesn't work

<div id=“jwplayer”>Loading the player...</div>
<script type="text/javascript">
var playerInstance = jwplayer(“jwplayer”);
playerInstance.setup({
sources: [{
file: "mysite/Facce_tv_low.mp4”,

},{
file: "mysite/Facce_tv.mp4"
}]
image: "mysite/Facce_tv1080.jpg",
width: 640,
height: 360,
title: 'title',
description: ‘description’,
mediaid: 'dW7FIoMA’,
logo: {
file: 'mysite/image.png',
hide: true,
link: 'mysite'
}
});
</script>


could anyone tell what's wrong?

thank you

13 Community Answers

Alex

JW Player Support Agent  
0 rated :

Hi, there.

My name is Alex and I am one of the Support Engineers at JW Player. I will be more than happy to assist you with your questions.

Can you please give me a link to a page where you have the affected player installed?

Thank you.

cipbarcellini N/A

User  
0 rated :

Thanks Alex and hello,

i just tried with the cloud player now, i put the library code on the head of the page:

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

and then body:

<div id=“http://content.jwplatform.com/libraries/Myplayer.js”>Loading the player...</div>
<script type="text/javascript">
var playerInstance = jwplayer(“http://content.jwplatform.com/libraries/Myplayer.js”);
playerInstance.setup({
sources: [{
file: "http://mysite/Facce_tv_low.mp4”,
label: “SD"
},{
file: "mysite/Facce_tv.mp4"
label: "HD"
}]
image: "mysite/Facce_tv1080.jpg",
title: 'Facce prestate a Cinema Teatro TV',
description: ‘di Cip Barcellini’,
mediaid: 'dW7FIoMA’,
logo: {
file: 'mysite/Cip60.png',
hide: true,
link: 'http://www.cipbarcellini.com/viaggiatore/attore/'
}
});
</script>

but it doesn't work...

link : http://www.cipbarcellini.com/viaggiatore/attore/faccetv/

thanks

Alex

JW Player Support Agent  
0 rated :

Hi, there.

I would not suggest naming the <DIV> in which you are embedding the player after the URL to the player library. I would suggest naming it something like “player”, or “myElement” as it is named in most of our documentation, so your code would look like this:

<div id="myElement">Loading the player...</div>
var playerInstance = jwplayer("myElement");

Please try that out and let me know if that resolves your issue.

Thanks.

cipbarcellini N/A

User  
0 rated :

Yes, i saw the documentation, i tried that, this was the last try when i use the player url...

anyway i just published the version of the code with "myElement", but it doesn't work

Alex

JW Player Support Agent  
0 rated :

Hi, there.

After taking a deeper look at your code, it looks like there’s some issues with the quotes you are using. Please see the screenshot linked below for a better representation of what I mean.

Screenshot – https://www.dropbox.com/s/13m9pq2f8y7owpw/69208_quotes.png?dl=0

Somehow, your setup code is using invalid characters for quotes. This can sometimes happen if you are copying and pasting some code from a document or a website. Another suggestion would be to stick to one type of quotes, as it looks like you switch to single-quotes when you are specifying your title, description, mediaid and logo fields. The mixing of single-quotes and double-quotes shouldn’t be that big of a deal and probably isn’t the cause of your issue, but its something that should be done just as a best practice.

Please let me know if replacing the quotes I specified in the screenshot works for you.

Thanks.

cipbarcellini

User  
0 rated :

Hello,

thank you for supporting me =)


unfortunately replacing the quotes doesn't solve the problem...

Alex

JW Player Support Agent  
0 rated :

Hi, there.

Not a problem, but it looks like you replaced the good quotes with the bad ones. Which text editor are you using for your code?

cipbarcellini N/A

User  
0 rated :

i see what you mean...

i fixed the quotes, hopefully with the good ones, but i still got the problem...

Alex

JW Player Support Agent  
0 rated :

I think you’re missing a comma after the last ] in the sources block, before the line with the image. It’s funny how such a little thing to cause such a big problem.

cipbarcellini N/A

User  
0 rated :

good eye, but even that didn't fix it =(

Alex

JW Player Support Agent  
0 rated :

OK, I copied and pasted all of your code into a new document and tried it on my end and there was one more issue that, after I fixed it, ended making the player work.

On the line with your second file URL in your sources block, you are missing a comma at the end.

cipbarcellini N/A

User  
0 rated :

That's it, Alex you made it!

I really appreciate it.
Thank you so much!

Alex

JW Player Support Agent  
0 rated :

No problem. Sorry it took so many back-and-forths to figure it out!

This question has received the maximum number of answers.