Trying to integrate Azure media player in React JS. but Azure dependent JavaScript lib function doesn't found "amp"
I think if you load the player's script in a sync way like script.async = false;
, it would work properly .. I know it would harm the performance, but unfortunately this is the way to go with loading this weirdly packaged player! .. I hate the fact that they didn't make an npm package for it!!
You could provide onload callback for your script like this:
script.onload = () => this.setState({libraryLoaded: true})
And then you can react on the state inside render method
render() { if (!this.state.libraryLoaded) { return <span>Loading...</span> } else { return ... // your component }}
Do not forget to initiate the state with libraryLoaded: false
You can also check my package which is basically doing this loading under the hood.