I need to include webrtc-adapter to my Angular 5 app.
What I need to do besides: npm install webrtc-adapter
?
Do I need to make any additional imports?
As you said you have to install int via npm npm install webrtc-adapter
, then you need to include it in your index.js
(or other main entry file) simply by doing:
import "webrtc-adapter";
at the top of it.
If you are using webpack instead of importing it you could add this to your webpack config as follow:
entry: {
application: "src/index",
vendor: [
"webrtc-adapter"
]
},
Here are some examples how I am doing it in my projects:
For an easy abstraction layer of WebRTC I recommend using peer-data
Include import 'webrtc-adapter';
in every component or service that uses WebRTC.
Also you need to import two zone.js patches:
// rtc peer connection patch
import 'zone.js/dist/webapis-rtc-peer-connection';
// getUserMedia patch
import 'zone.js/dist/zone-patch-user-media';
If you are using angular-cli
you should add these lines in polyfills.ts
after import 'zone.js/dist/zone';
that's already in this file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With