angular-cli 5 how to import web rtc adapter

966 views
Skip to first unread message

xplod...@gmail.com

unread,
Feb 2, 2018, 2:20:23 AM2/2/18
to Angular and AngularJS discussion

I have used npm to install webrtc-adapter,
i want to know what other steps i need to take to
make the adapter available inside one of my components.

i have tryed to add import "webrtc-adapter" to main.ts file
i have tryed differnt methods to import into component

import * as adapter from /node_modules/webrtc/out/adapter
import { adapter } from /node_modules/webrtc/out/adapter

let adapter = require('webrtc-adapter)

and ect,

what am i missing?

Sander Elias

unread,
Feb 4, 2018, 11:21:08 PM2/4/18
to Angular and AngularJS discussion
Hi xploder,

You are loading a shim. the sim itself is as good as invisible to your code.
Just doing a:

Import "adapter_no_global.js"

Should be enough to get the thing going in the file you are working in.
Use the RTC stuff as it is specced, and it's supposed to work.

Regards
Sander

xplod...@gmail.com

unread,
Feb 8, 2018, 6:05:16 PM2/8/18
to Angular and AngularJS discussion
Hi Sander,

Thanks for the answer,

i have got some progress by adding the adapter to the import "adapter_no_global" to the main.ts file as an import,

i now get

Attempting to configure 'ontrack' with descriptor {} on object [object RTCPeerConnection] and got error, giving up: TypeError: Cannot redifine property: ontrack

I assume this is an ontrack problem? and not an adapter problem!

i am still unable to import the adapter into my ts component as it throws a js warning

my project is angular 5-cli typescript project
import * as adapter from 'node_modules/webrtc-adapter/out/adapter_no_global.js"

i want to use
console.log(adapter.browserDetails.browser);
console.log(adapter.browserDetails.version);

in my ts component

what syntax can i use to import
adapter handle?

ps thanks in advance
Reply all
Reply to author
Forward
0 new messages