dwyl / learn-phoenix

:fire: Phoenix is the web framework without compromise on speed, reliability or maintainability! Don't settle for less. :rocket:
649 stars 45 forks source link

p.164 player does not load video! Uncaught TypeError: _player2.default.init is not a function #49

Closed nelsonic closed 7 years ago

nelsonic commented 7 years ago

When trying to view a valid video url/id on page 164 of the Programming Phoenix book, the video is not displaying.

When I open DevTools > Console I see the following error:

Uncaught TypeError: _player2.default.init is not a function

Screenshot: image

Everything else appears to be working but the video is not being loaded. I've tried searching the book's "errata" page: https://pragprog.com/titles/phoenix/errata and spent some time googling for the error text and more generic keywords.

I suspect that the error is because we haven't said how the web page should get get the YT script ... but I could be wrong.

If anyone else has come across this issue, please share how you resolved it! thanks! 👍

On a side note this type of is not a function error doesn't happen in Elm! https://github.com/dwyl/technology-stack/issues/27#issuecomment-283097231

nelsonic commented 7 years ago

It was failing because I missed out the export default Player line. see: https://github.com/dwyl/learn-phoenix-framework/blob/7d222efdd44d94d5a1af463dc4f2fbd0e845aae4/rumbl/web/static/js/player.js#L31