GangOne Style
GangOne Style

Reputation: 81

Jw player error when embed code youtube video

i need help. i have a problem with JW Player embed code using youtube i had tried follow the tutorial on following link: How to embed using youtube

and this is my code :

<body>
<script type="text/javascript" src="jwplayer/jwplayer.js"></script>
<div id="myElement"></div>
<script>
    jwplayer("myElement").setup({
        flashplayer: 'jwplayer/player.swf',
        file: "https://www.youtube.com/watch?v=KdF_nqQy8qQ",
        width: 640,
        height: 360
    });
</script>
</body>

but when i try my code, video doesn't show and this is the error message show on console chrome :

GET http://localhost/stc/jwplayer/undefined 404 (Not Found)

please help me.

Upvotes: 1

Views: 1691

Answers (2)

emaxsaun
emaxsaun

Reputation: 4201

JW Player needs to be at least embedded in a local web server in order to work. I just tested your code and it works fine. Try this sample code on either a local web server or public test page, it works.

<body>
<script type="text/javascript" src="http://p.jwpcdn.com/6/12/jwplayer.js"></script>
<div id="myElement"></div>
<script>
    jwplayer("myElement").setup({
        file: "https://www.youtube.com/watch?v=KdF_nqQy8qQ",
        width: 640,
        height: 360
    });
</script>
</body>

Upvotes: 2

Rachel Gallen
Rachel Gallen

Reputation: 28583

To embed this video into html simply use an iframe

<iframe width="640" height="360" src="https://www.youtube.com/embed/KdF_nqQy8qQ?rel=0" frameborder="0" allowfullscreen></iframe>

Upvotes: 0

Related Questions