I'm trying to load opentokjs from cdn using requirejs as described here: https://forums.tokbox.com/javascript/loading-javascript-using-requirejs-t42411.
In my main.js i have
shim:{
'ng-tok': {
'exports': 'ng-tok',
'deps': ['OT', 'angular']
},
'tbjs': {
'exports': 'OT'
}
}
paths:{
'tbjs' : ['//static.opentok.com/webrtc/v2.2/js/opentok.min'],
}
But I'm getting Script error for: OT
How do I properly load opentokjs via requirejs?
You should use 'tbjs' rather than 'OT' in the 'deps' of 'ng-tok'.
shim:{
'ng-tok': {
'exports': 'ng-tok',
'deps': ['tbjs', 'angular']
},
'tbjs': {
'exports': 'OT'
}
}
paths:{
'tbjs' : ['//static.opentok.com/webrtc/v2/js/opentok.min'],
}
Change the version v2.2 to v2 to get the latest version. Thank @Ankur for his comment and sorry for my misunderstanding.