aws-samples / amazon-ivs-player-web-sample

This project contains code samples demonstrating how to build, package, and integrate with the Amazon IVS Player Web SDK.
https://docs.aws.amazon.com/ivs/
MIT No Attribution
81 stars 32 forks source link

Cannot read properties of undefined (reading 'startsWith') and Uncaught SyntaxError: Unexpected token '<' (at [object Object]:1:1) #59

Closed suzy-g38 closed 2 years ago

suzy-g38 commented 2 years ago

I am trying to build a reactJs application using amazon-ivs-player with videojs integration and got 'Cannot read properties of undefined (reading 'startsWith')' and Uncaught SyntaxError: Unexpected token '<' (at [object Object]:1:1). So, after trying to converting web-sample's videoJs example into reactJs found these errors in codesandbox: Unable to open 'amazon-ivs-wasmworker.min.js': File not found (file:///sandbox/node_modules/amazon-ivs-player/dist/assets/amazon-ivs-wasmworker.min.js) and Unable to open 'index.js': File not found (file:///sandbox/node_modules/amazon-ivs-player/dist/index.js). Below I am pasting the codesandbox link: https://codesandbox.io/s/recursing-sid-t2zxi9?file=/src/VideoPlayer.jsx I can't use the script tag or any link that is mentioned in the official documentation due to some limitations. So if is there any help to fix these issues it will be a great help. Thank you.

neer300 commented 2 years ago

Thank you for using amazon-ivs-player-web-sample and reporting this issue.

The problem you see seems to be related to react-scripts and the default boilerplate and configs it comes with. The webpack.config.js in your codesandbox project may not have the intended effect of loading the worker and webassembly assets.

Customizing / overriding default react-scripts configurations is outside the scope here. Your developer experience may be better if you build your reactjs app without using react-scripts

suzy-g38 commented 2 years ago

Can't I resolve the issue without touching the react-scripts. Originally project will be a nextJs project.

neer300 commented 2 years ago

Thank you for reaching out.

Given your project environment, we can recommend using the player assets via Githubissues.

  • Githubissues is a development platform for aggregating issues.