javascript - Insert YouTube player with JQuery HTML -


i'm done mini-project have put lot of work into! thing need put youtube link player html , don't how start.

so i'm doing take information api have youtube link ready example https://youtu.be/mh2ebpxhols , need shown in html youtube player. problem don't know how start it.

this how site looks right now:

my site

as see there youtube trailer link @ bottom haven't got "level" yet , need it!

basically trailer movie i'm searching , want under poster, somewhere there can myself. problem need know how make youtube player understand youtube link.

right i'm using in html

<div id="trailer"></div> 

js:

$('#trailer').html("trailer: " + data.trailer); 

and have no css trailer yet.

so want know, how can make link understand , fill html youtube player?

from understand want id link , use fill html youtube iframe. can using replace.

var videoid = data.trailer.replace("https://youtu.be/", ""); //leaves id $('#trailer').html("trailer: <iframe width='420' height='315' src='https://www.youtube.com/embed/" + videoid + "' frameborder='0' allowfullscreen>"); 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -