Adding MediaElement.js7:05 with Joel Kraft
Let's download and install the MediaElement player in an existing webpage.
- Note: Heads up! The MediaElement page layout has changed since this was recorded. Click "Installation" after following the link above to find the instructions.
jQuery is no longer Included in MediaElement download. MediaElement still requires jQuery to work, though. To get jQuery, the best way is to link to a CDN, as in the snippet below under the "Code" heading. If you'd like to download it yourself and serve it from your
js folder, the way it is done in the video, you can get a copy by clicking here. If that link renders a page of text, you can just select all (cmd or ctrl + A) and copy the text, pasting it into a new file called
jquery.js. Alternatively, you could go to the jQuery download page, and download the version you want to use.
Links to the documents in
<script src="js/jquery.js"></script> <script src="js/mediaelement-and-player.min.js"></script> <link href="css/mediaelementplayer.css" rel="stylesheet">
Alternatively, you can use a CDN to serve jQuery, which is generally recommended. Instead of linking to it from the js folder as demonstrated above, use a link from this page. The script tag will look something like this:
<script src="http://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
Centering an Element with CSS
You need to sign up for Treehouse in order to download course files.Sign up