Allow peers w/o streams to receive streams, closes #26

Related to: https://github.com/feross/simple-peer/issues/95
This commit is contained in:
Jerko Steiner 2017-06-18 08:56:11 -04:00
parent 8a8c7b570f
commit df37ed93fb
3 changed files with 12 additions and 6 deletions

View File

@ -45,6 +45,6 @@ export const getCameraStream = () => dispatch => {
})
.catch(err => {
dispatch(NotifyActions.alert('Could not get access to microphone & camera'))
throw err
return null
})
}

View File

@ -83,8 +83,14 @@ export function createPeer ({ socket, user, initiator, stream }) {
const peer = new Peer({
initiator: socket.id === initiator,
stream,
config: { iceServers }
config: { iceServers },
// Allow the peer to receive video, even if it's not sending stream:
// https://github.com/feross/simple-peer/issues/95
offerConstraints: {
offerToReceiveAudio: true,
offerToReceiveVideo: true
},
stream
})
const handler = new PeerHandler({

View File

@ -80,11 +80,11 @@ describe('reducers/alerts', () => {
const promise = store.dispatch(CallActions.init())
socket.emit('connect')
promise
.then(done.fail)
.catch(err => {
expect(err.message).toEqual('test')
.then(result => {
expect(result.value).toBe(null)
done()
})
.catch(done.fail)
})
})