Youtube Video In Html Not Working
I try to get a URL of a YouTube-video from database and embed it in a page. I get the 'An error occured. Please try again later' message. Pls help! :( String in the DB: https://ww
Solution 1:
Assuming that arr['Trailer'] == "https://www.youtube.com/watch?v=JjFsNSoDZK8"
Try to change your replace to the following:
arr['Trailer'].replace("https://www.youtube.com/watch?v=", "//www.youtube.com/embed/");
jsFiddle - http://jsfiddle.net/WFd79/
Solution 2:
I see a couple things wrong:
//www.youtube.com/embed/JjFsNSoDZK8
Not the url with the id as a the value ofv
get parameter; like the link you have in your post (https://www.youtube.com/watch?v=JjFsNSoDZK8)When you replace the url you are adding the param with
?
i think it should be&
since the query string already exists, i don't think it matters though because http://www.youtube.com/embed/JjFsNSoDZK8 is the correct url according to theembed
tab on youtube
url = 'https://www.youtube.com/watch?v=JjFsNSoDZK8';
url.replace('youtube.com/', 'youtube.com/embed/') + "?feature=player_detailpage"// "https://www.youtube.com/embed/watch?v=JjFsNSoDZK8?feature=player_detailpage"
Solution 3:
Try to replace "https://www.youtube.com/watch?v=" to "//www.youtube.com/embed/" then it will work.
Post a Comment for "Youtube Video In Html Not Working"