alxhotel / chromecast-api

:tv: Chromecast Node.js module
MIT License
155 stars 49 forks source link

After Installation: Uncaught TypeError: Cannot read property 'substr' of undefined #67

Open Vulcanostrol opened 3 years ago

Vulcanostrol commented 3 years ago

Hi, this looks like a great library, but I have trouble installing it with Vue.

I have run npm install chromecast-api and after this, ran the following code from the tutorial:

const ChromecastAPI = require('chromecast-api')

const client = new ChromecastAPI()

client.on('device', function (device) {
  var mediaURL = 'http://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4';

  device.play(mediaURL, function (err) {
    if (!err) console.log('Playing in your chromecast')
  })
})

When opening the app, I get the following error in the Chrome developer console:

image

It looks like it already occurs when importing the library, as something as short as new ChromecastAPI() also gives the error. This is most likely an installation issue or a incompatibility with another installed NPM package in my part.

Is this a known issue? Thanks.

Note: https://github.com/alxhotel/chromecast-api/issues/34 looks similar