Stupid question
DanieleMar opened this issue · 3 comments
DanieleMar commented
As is it known YT Iframe API works on front-end. My question is: How can we use 'require' on front-end part?
After a little search I found that it is suggested on Stack to use tool like Ender or Parcel.
Is it yours implied ways to works with this npm?
Let me know..
setalosas commented
You can use it with ES6 import this way:
import * as YTPlayer from '../wherever/feross-yt-player.js'
...
const u2Player = new YTPlayer.YouTubePlayer(u2Frame$, playerApi.opts)
...
At least that's how I use it.
setalosas commented
I mean you don't have to use this needless Javascript infrastructure overcomplexities at all if you use ES6.
emahuni commented
use unpkg if you want to directly import in browser without bundlers inbetween
import YTPlayer from 'https://unpkg.com/yt-player@3.4.0/dist/yt.player.js'