Skip to content

Commit

Permalink
Fix peer connection error
Browse files Browse the repository at this point in the history
  • Loading branch information
adrigardi90 committed Jul 17, 2019
1 parent cb6d1e7 commit da611c3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
'eslint:recommended'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-console': process.env.NODE_ENV === 'production' ? 'off' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
},
parserOptions: {
Expand Down
26 changes: 13 additions & 13 deletions src/components/VideoArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,19 @@ export default {
}),
async created() {
this.username = this.$store.state.username;
await this.getUserMedia();
this.addLocalStream();
await this.getAudioVideo();
// Create peer connection
this.createPeerConnection();
// Add local stream
this.addLocalStream();
// Event listeners
this.onIceCandidates();
this.onAddStream();
!this.videoAnswer.video ?
this.callFriend() : // Caller
this.handleAnser() // Callee
Expand All @@ -68,22 +77,13 @@ export default {
this.remoteVideo = document.getElementById("remoteVideo");
},
methods: {
async callFriend() {
callFriend() {
log(`${this.username} wants to start a call`);
this.createPeerConnection();
// Event listeners
this.onIceCandidates();
this.onAddStream();
await this.createOffer();
this.createOffer();
},
async handleAnser() {
log(`${this.username} gets an offer from ${this.videoAnswer.from}`);
this.createPeerConnection();
// Event listeners
this.onIceCandidates();
this.onAddStream();
await this.setRemoteDescription(this.videoAnswer.remoteDesc);
this.createAnswer();
Expand Down

0 comments on commit da611c3

Please sign in to comment.