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

Uncaught SyntaxError: Unexpected token ILLEGAL - doesn't see library etc



Hi folks,

I used the embedding wizards on the jwplayer site to the T, and the player works fine in the preview mode in the embedding wizard, BUT no matter what I do, when I copy the code over and try and run the player from my own html, either on a local machine, or on any number of other servers, no player appears and the js browser console message states: "Uncaught SyntaxError: Unexpected token ILLEGAL 123456789.js" then under that "Uncaught ReferenceError: jwplayer is not defined "
So, it works in the wizard preview, but not in my own pages. Copied code into an entirely blank html doc, just with header and body and doctype - have tried everything - getting nowhere!
Any ideas?
Please help - driving me crazy!
Many thanks,

23 Community Answers

jherrieven

User  
0 rated :

A link to your broken page/code would be useful.

James Herrieven

abstractradiomail

User  
0 rated :

wont I then be providing you with my jwplayer code?

MisterNeutron

User  
1 rated :

Your JW Player key is visible to anyone who visits your site. It's not a secret.

abstractradiomail

User  
0 rated :

OK here is code with my personal library and stream details removed.

<!DOCTYPE html><html> <head>

<script src="http://jwpsrv.com/library/myjwcloudlibrarycode.js"></script>
</head>
<body>
<div id='playerkzFkXcPgsAeS'></div>
<script type='text/javascript'>
jwplayer('playerkzFkXcPgsAeS').setup({
file: 'http://mystreamname.com:12345/;stream.mp3',
image: 'https://scontent-lhr.xx.fbcdn.net/hphotos-xpt1/v/t1.0-9/10347169_369029653256126_3466004654688343896_n.jpg?oh=5b626650d5164709b18c9ed3836a4a54&oe=55B825AD',
title: 'mystreamtitle',
width: '640',
height: '30',
autostart: 'true'
});
</script>

</body></html>

Works perfectly in the wizard, throws up errors in the real world.

MisterNeutron

User  
0 rated :

Just a WAG, but try removing the image attribute. With an audio player at only 30px high, it's not doing anything.

A link to a live page would be much more useful than posting code.

abstractradiomail

User  
0 rated :

Hi,
Removal of image line makes no difference :(

abstractradiomail

User  
0 rated :

I hope you can understand that I wish to keep stream details and key code private as much as possible - especially not posting them on a board

MisterNeutron

User  
0 rated :

Are you not going to have any visitors to your site? You can send a link privately to JW support, but that means no one here will be able to offer any assistance.

abstractradiomail

User  
0 rated :

Is there a general .js code we could use?

abstractradiomail

User  
0 rated :

and I could find an alternative stream address to test with...

abstractradiomail

User  
0 rated :

OK. Here is full code, generated by wizard. Works in wizard preview., but not elsewhere

Here is live link.

http://abstractradio.1apps.com/test-player-1.html

Same error messages as on local machine.

Another live link:

http://abstractradio.hostei.com/test-player-1.html

throws up chinese!!


___________________________________________

<!DOCTYPE html>
<html>
<head>
<script src="http://jwpsrv.com/library/4sbztM9hEeSB3hJtO5t17w.js"></script>
</head>
<body>
<div id='playerkzFkXcPgsAeS'></div>
<script type='text/javascript'>
jwplayer('playerkzFkXcPgsAeS').setup({
file: 'http://free-shoutcast.com:18122/;stream.mp3',
image: '//www.longtailvideo.com/content/images/jw-player/lWMJeVvV-876.jpg',
title: 'just a test',
width: '640',
height: '30',
autostart: 'true'
});
</script>
</body>
</html>

MisterNeutron

User  
0 rated :

Works when I do it:

http://misterneutron.com/JW6audioStream/

No "image" attribute (where do you think it would display an image in a div that's only 30px tall?), and self-hosted script.

jherrieven

User  
0 rated :

The JW library is being interpreted as Chinese in the browser - but appears fine if you go directly to it.

Now, we have seen this before, but I can't remember the resolution - and can't seem to find the details in the forum!

@MisterNeutron - can you remember? Does your example still work if you switch the library to use @abstractradiomail's?

James

MisterNeutron

User  
0 rated :

Yup, works just fine if I use http://jwpsrv.com/library/4sbztM9hEeSB3hJtO5t17w.js instead of the self-hosted script. I've uploaded the revised version as:

http://misterneutron.com/JW6audioStream/index2.html

(BTW, I guess I'm a Luddite, but I don't understand why anyone would use the JW-hosted scripts. That just introduces another potential failure point for your page. I know that pulling resources from 27 different places is all the rage these days, but I see example after example of why it's a lousy idea.)

The "render unto Chang" phenomenon doesn't really ring a bell with me, but I'll pop back in if it surfaces.

abstractradiomail

User  
0 rated :

Hi again,

Agreed, it does work in your link Mr Neutron, but if I copy that file to my machine, it still does not!

Also, if I copy your file to:

http://abstractradio.hostei.com/test-player-2.html

it is still pumping out mandarin and not working, and if I copy it here:

http://abstractradio.1apps.com/test-player-2.html

it is also not working.

Have tried all these files on a number of different machines, not working on any of them.

So, my question to the panel is: how can it be that the SAME FILE works here:

http://misterneutron.com/JW6audioStream/index2.html

but no where else?

This is crazy.
Please help before I head for the hills.

ps - would love to use self-hosted script, but can't currently get it working in any guise, self or jw hosted.
pps - the image came from the jw-wizard. I just thought it would be best to play along.

Andrew

JW Player Support Agent  
-1 rated :

Oh man… this issue again…

I remember that this had something to do with the encoding of the site/server itself. It’s true, loading even the cloud-hosted player in this scenario is making the response Chinese.

Andrew

JW Player Support Agent  
0 rated :

Additionally, running your page through here:
http://validator.w3.org/i18n-checker/check?uri=abstractradio.1apps.com%2Ftest-player-1.html#validate-by-uri+

Is offering some suggestions.

abstractradiomail

User  
0 rated :

Code is identical to that which IS working on Mr's Neutron's site.
But it won't work on any of my windows machines - Vista/7/8, in any browser, either loaded locally or through any of the above sites (bar Mr Neutron's).
Weirder and weirder...

MisterNeutron

User  
0 rated :

Your server is encoding the pages with UTF-16 instead of UTF-8. I don't know IIS, so I have no idea how to fix this. But I believe this is the heart of the problem.

abstractradiomail

User  
0 rated :

Hi,
Have tested on php servers - that's where it throws up the mandarin, while just doesn't work on the others.(?IIS)
What server are you using?

MisterNeutron

User  
0 rated :

Plain vanilla Linux/Apache - very ordinary bargain shared hosting.

abstractradiomail

User  
0 rated :

The answer, my friends...

Well, it turns out to have (1) nothing to do with the .js and (2) nothing to do with the server.

The problem is due to how the original .html file containing the player and links to the .js file(s) is itself encoded.
I was using wordpad as an editor and I guess it was saving html either in unicode or ANSI, which, as a general rule, works fine for 99.99% of all web-work.

But, swapped to using notepad, saved index.html using UTF-8 encoding instead, and lo! - jwplayer appears to works fine!

Which leads me to say ... this (jwplayer) is some proper dumbass code if it requires the source file pointing to its engine to adhere to a specific encoding type.

MisterNeutron

User  
0 rated :

Yeah, but when your entire page is showing Chinese characters, it's a little tough to blame that on JW Player, isn't it? The fact is that UTF-16 encoding is not supported in the browser. Has nothing to do with JW Player.

This question has received the maximum number of answers.