react-peer-chat 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +2 -2
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import Peer from 'peerjs';
|
|
2
3
|
import useStorage from './useStorage';
|
|
3
4
|
import { BsFillMicFill, BsFillMicMuteFill } from './icons';
|
|
4
|
-
export default function Chat({ peerId, remotePeerId, peerOptions
|
|
5
|
+
export default function Chat({ peerId, remotePeerId, peerOptions, onError = () => console.error("Can not access microphone!") }) {
|
|
5
6
|
const [audio, setAudio] = useStorage('rpc-audio', false, { local: true, save: true });
|
|
6
7
|
const streamRef = useRef(null);
|
|
7
8
|
const localStream = useRef();
|
|
@@ -9,7 +10,6 @@ export default function Chat({ peerId, remotePeerId, peerOptions = {}, onError =
|
|
|
9
10
|
useEffect(() => {
|
|
10
11
|
if (!audio)
|
|
11
12
|
return;
|
|
12
|
-
const Peer = require('peerjs').default;
|
|
13
13
|
const peer = new Peer(`rpc-${peerId}`, peerOptions);
|
|
14
14
|
let call;
|
|
15
15
|
peer.on('open', () => {
|