Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stupid question #68

Open
ghost opened this issue Mar 30, 2021 · 3 comments
Open

Stupid question #68

ghost opened this issue Mar 30, 2021 · 3 comments

Comments

@ghost
Copy link

ghost commented Mar 30, 2021

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
Copy link

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
Copy link

I mean you don't have to use this needless Javascript infrastructure overcomplexities at all if you use ES6.

@emahuni
Copy link

emahuni commented Jan 2, 2024

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants