Reputation: 3847
I was trying to follow Janus videoroom example but I have an error when calling attach on janus instance:
janus.nojquery.js:681 200: Could not parse response, error: ReferenceError: adapter is not defined, text: {
"janus": "success",
"transaction": "Y0WiAA79RQ9l",
"data": {
"id": 7571647455176760
}
}
This doesnt allow me to get videoroom pluginHandle so I cant communicate with plugin.
below is codesnipet that I try to make work:
Janus.init({debug: "all", callback: function() {
const janusInstance = new Janus(
{
server: 'http://localhost:1414/janus',
success: function () {
console.log('connected', janusInstance)
janusInstance.attach(
{
plugin: "janus.plugin.videoroom",
opaqueId: Janus.randomString(12),
success: function (pluginHandle) {
console.log('plugin handle received', pluginHandle)
},
onmessage: function(msg, jsep) {
console.log(msg, jsep)
},
onlocalstream: function(stream) {
console.log(stream)
},
error: function (error) {
console.error(error)
}
}
)
},
error: function(error) {
console.error(error)
}
})
}})
as Janus server I use served locally docker image: https://github.com/canyanio/janus-gateway-docker
any help will be highly appreciated. Thank you!
Upvotes: 0
Views: 2000
Reputation: 11
If I correctly understand your problem - you need to paste adapter on initialization Janus.
But before that - import your adapter into component or install it in a project (write a src=".../example-adapter.js"
), for example:
import adapter from "webrtc-adapter"
- choose necessary directory or library to your adapter.
Then add a field "dependencies" to Janus.init({})
in this way:
Janus.init({
debug: true,
dependencies: Janus.useDefaultDependencies({ adapter: adapter }),
callback: function() {},
})
Upvotes: 1