Javascript in VueJS App

222 views
Skip to first unread message

Jed Palmater

unread,
Aug 29, 2019, 11:29:15 AM8/29/19
to meetecho-janus
Hi Everyone, 
 Been going through the documentation and the repo over the last few days and I must say this a really well flushed set up, I appreciate all the hard work that has gone into this. 

I am trying to set up a frontend for a Janus room. I'm using the javascript API and have generated an ES6 Module as recommend by the documentation. I have several odd behaviours when trying to initialise the Janus object. 

1. First I get an error for "ReferenceError: adapter is not defined"
2. If I change the dependencies to use an empty object I get init not defined (kinda makes sense) 
3. if I pass a webrtc adapter object that is imported from the npm package to dependencies object, I get the same "TypeError: Cannot read property 'init' of undefined"

How do I import and initialise this, do I need to bring in extra deps? how and what? 

Hope you can help, thanks,
Jed

Lorenzo Miniero

unread,
Aug 30, 2019, 4:39:37 AM8/30/19
to meetecho-janus
Sorry, not familiar with VueJS, you may want to ask on their group/github.

Lorenzo

Max Babich

unread,
Aug 30, 2019, 5:37:13 PM8/30/19
to meetecho-janus
Hi Jed

Adapter it is  https://github.com/webrtchacks/adapter and you need import him.
 You have two way of imports:
 a) global - paste in tag <script> in static html or use VueStore and load into first render
 b) import adapter from 'webrtc-adapter'; 
    It's a little bit harder this way but more correct. In step init you need import webretc lib to JanusJS like this:
    
Janus.init({
    debug: true,
    dependencies: Janus.useDefaultDependencies({adapter: adapter}),
    callback: function() {  /* Done! */}
});

To use `import adapter from 'webrtc-adapter'`, you have to compile lib by rollupjs. All rollupjs config instance into npm.
npm run rollup -- --o /path/to/desired/output/file-name.js --f es

четверг, 29 августа 2019 г., 18:29:15 UTC+3 пользователь Jed Palmater написал:

Jake Withecombe

unread,
Sep 5, 2019, 6:27:46 PM9/5/19
to meetecho-janus
It's a bit of a mess but here's a starter that may point you in the right general direction:

https://github.com/jakew009/vuejs-janus-multistream-test

Jed Palmater

unread,
Sep 9, 2019, 10:32:47 AM9/9/19
to meetecho-janus
Thanks so much Jake! this was exactly what I needed to get going! 

Sorry for the late reply, I was on vacation for a week :D
Reply all
Reply to author
Forward
0 new messages