Reputation: 584
I'm using PeerJS for a video conferencing application. And I need to use util.supports.audioVideo
to check if the browser support WebRTC audio and video features.
The PeerJS documentaiton doesn't says how to import util object. I tried to import util from PeerJS, and these are not worked for me.
import Peer, { util } from 'peerjs' // Getting util as an interface
import { util } from 'peerjs/lib/util' // Getting webpack loader error
Upvotes: 0
Views: 190
Reputation: 33
After importing 'Peer' or using a CDN, you can access the util object via window.
console.log(window.peerjs.util);
Using it with typescript could look like this:
import { util } from 'peerjs';
declare global {
interface Window {
peerjs: { util: util };
}
}
Upvotes: 2