feross/yt-player

Accessing DOM Elements in Node?

Wai-Yan opened this issue · 1 comments

Hi, sorry if this is a basic question. When I attempt to start up an Express server to run the example code, I get this error:

/Users/me/Project/node_modules/yt-player/index.js:48
? document.querySelector(element)
^
ReferenceError: document is not defined

In the actual file I assume it is because the parameter in the function
const player = new YTPlayer('#player');
Is using the querySelector function.

How might I access the DOM from a Node file? Is it necessary to use Browserify or something to run all of it in the frontend?

Thanks for the package.

This package is meant to be used on the frontend, not on the server-side.