Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Botos Claudia
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Botos Claudia
Front End Web Development Techdegree Graduate 18,765 Points

Uncaught SyntaxError: Unexpected identifier

I am currently working at the Interactive Video Player in the FWD techdegree and I seem to get this error in my console and it also seems that none of the styles I try to apply seem to work. I am trying to apply mediaelement.js to my project. I followed the steps from Nick Pettit's Adding medialelement.js video and it does not seem to work. I am getting into my console this error : Uncaught SyntaxError: Unexpected identifier. Could someone please help me understand what have I done wrong? Thank's in advance ! ;)

<!DOCTYPE HTML>

<html lang="en">

<head> <meta charset="utf-8"> <title>Video Player</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel='stylesheet' href='css/normalize.css'> <link rel="stylesheet" href="css/styles.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/mediaelement/4.1.0/mediaelementplayer-legacy.min.css"> <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">

</head>

<body>

<main class='wrapper'>

<video controls class='video mejs-custom'> <source src='video/video.mp4' type='video/mp4'> <source src='video/video.ogg' type='video/ogg'>

</video>

<div id="subtitles">

<p class='first-p'>

<span id="l1" class="line" data-end="00:00:04.130" data-start="00:00:00.240">Now that we've looked at the architecture of the internet, let's see how you might</span>

<span id="l2" class="line" data-end="00:00:07.535" data-start="00:00:04.130">connect your personal devices to the internet inside your house.</span>

<span id="l3" class="line" data-end="00:00:11.270" data-start="00:00:07.535">Well there are many ways to connect to the internet, and</span>

<span id="l4" class="line" data-end="00:00:13.960" data-start="00:00:11.270">most often people connect wirelessly.</span>

 </p>



 <p class='second-p'>

<span id="l5" class="line" data-end="00:00:17.940" data-start="00:00:13.960">Let's look at an example of how you can connect to the internet.</span>

<span id="l6" class="line" data-end="00:00:22.370" data-start="00:00:17.940">If you live in a city or a town, you probably have a coaxial cable for</span>

<span id="l7" class="line" data-end="00:00:26.880" data-start="00:00:22.370">cable Internet, or a phone line if you have DSL, running to the outside of</span>

<span id="l8" class="line" data-end="00:00:30.920" data- start="00:00:26.880">your house, that connects you to the Internet Service Provider, or ISP.</span>

<span id="l9" class="line" data-end="00:00:34.730" data-start="00:00:32.100">If you live far out in the country, you'll more likely have</span>

 <span id="l10" class="line" data-end="00:00:39.430" data-start="00:00:34.730">a dish outside your house, connecting

you wirelessly to your closest ISP, or </span>

  <span id="l11" class="line" data-end="00:00:41.190" data-start="00:00:39.430">you might also use the telephone system.

</span>

 </p>


 <p class='third-p'>

 <span id="l12" class="line" data-end="00:00:46.300" data-start="00:00:42.350">Whether a wire comes straight from

the ISP hookup outside your house, or </span>

<span id="l13" class="line" data-end="00:00:49.270" data-start="00:00:46.300">it travels over radio waves from your roof, </span>

<span id="l14" class="line" data-end="00:00:53.760" data-start="00:00:49.270">the first stop a wire will make once inside your house, is at your modem.

</span>

<span id="l15" class="line" data-end="00:00:57.780" data-start="00:00:53.760">A modem is what connects the internet to your network at home. </span>

<span id="l16" class="line" data-end="00:01:00.150" data-start="00:00:57.780">A few common residential modems are DSL or </span>

</p>

</div>

</main>

<script src='js/jquery-3.1.1.min.js'></script> <script src="https://cdn.jsdelivr.net/mediaelement/4.1.0/mediaelement-and-player.min.js"></script> <script src='js/main.js'> </script> </body> </html>

And here is my JS code :

$('video').mediaelementplayer({

success: function(player, node) 
{
 $('#' + node.id + '-mode').html('mode: ' + player.pluginType);
}

startLanguage: 'en',
translationSelector: true

});

2 Answers

Florian Tönjes
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Florian Tönjes
Full Stack JavaScript Techdegree Graduate 50,856 Points

Hi Popa Claudia,

just add a comma and it should do the trick.

This:

$('video').mediaelementplayer({

success: function(player, node) 
{
 $('#' + node.id + '-mode').html('mode: ' + player.pluginType);
}

startLanguage: 'en',
translationSelector: true

});

To this:

$('video').mediaelementplayer({

success: function(player, node) 
{
 $('#' + node.id + '-mode').html('mode: ' + player.pluginType);
},

startLanguage: 'en',
translationSelector: true

});

Kind Regards, Florian

Nicolas Hampton
Nicolas Hampton
44,625 Points

Popa,

As a Techdegree student, I recommend that you post this question in the Project-7 slack channel here and see if your fellow students there have any solutions: https://treehouse-fewd-td.slack.com/messages/C0PPX0A6R