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

youtube videos not working


I cant make youtube videos play

this is my code
$(document).ready(function(){

jwplayer("myDiv").setup({
file: "https://www.youtube.com/watch?v=oDPtMh-mpDw",
image: "images/P1090566.JPG",
height: 360,
width: "100%",
aspectratio: "16:9",
controls:false
});

jwplayer().onReady(function(e) {
jwplayer("myDiv").play();
});

});

I have tried JW player 6 and 7
i have tried changeing the aspec ratio property to a fixed height
i have tried the youtube link without https:

every single time i get a long pause and then the following error appears in the console

Failed to load resource: net::ERR_FILE_NOT_FOUND - file://www.youtube.com/iframe_api

1 Community Answers

Donni

JW Player Support Agent  
0 rated :

I’m able to get it to work outside of jQuery

Make sure the div exists in the dom and the player is finished loading before having it call .setup

This question has received the maximum number of answers.