Skip to content

Commit f1ed940

Browse files
committed
Added error catching for browser compatability.
1 parent eee7fd9 commit f1ed940

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

minivid2.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<input type="submit" name="login_submit" value="Log In">
3636
</form>
3737
-->
38-
<form name="loginForm" id="login" action="#" onsubmit="return login(this);">
38+
<form name="loginForm" id="login" action="#" onsubmit="return errWrap(login,this);">
3939
<span class="input input--nao">
4040
<input class="input__field input__field--nao" type="text" name="username" id="username" placeholder="Enter A Username"/>
4141
<label class="input__label input__label--nao" for="username">
@@ -60,7 +60,7 @@
6060
-->
6161

6262

63-
<form name="callForm" id="call" action="#" onsubmit="return makeCall(this);">
63+
<form name="callForm" id="call" action="#" onsubmit="return errWrap(makeCall,this);">
6464
<span class="input input--nao">
6565
<input class="input__field input__field--nao" type="text" name="number" id="call" placeholder="Enter User To Call!"/>
6666
<label class="input__label input__label--nao" for="number">
@@ -165,6 +165,15 @@
165165
$('#logs').append("<p>"+log+"</p>");
166166
}
167167

168+
function errWrap(fxn, form){
169+
try {
170+
return fxn(form);
171+
} catch(err) {
172+
alert("WebRTC is currently only supported by Chrome, Opera, and Firefox");
173+
return false;
174+
}
175+
}
176+
168177
</script>
169178

170179
<script>

stream.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</div>
3030

3131

32-
<form name="streamForm" id="stream" action="#" onsubmit="return stream(this);">
32+
<form name="streamForm" id="stream" action="#" onsubmit="return errWrap(stream,this);">
3333
<span class="input input--nao">
3434
<input class="input__field input__field--nao" type="text" name="streamname" placeholder="Enter Stream Name" id="streamname"/>
3535
<label class="input__label input__label--nao" for="streamname">
@@ -47,7 +47,7 @@
4747
</form>
4848

4949

50-
<form name="watchForm" id="watch" action="#" onsubmit="return watch(this);">
50+
<form name="watchForm" id="watch" action="#" onsubmit="return errWrap(watch,this);">
5151
<span class="input input--nao">
5252
<input class="input__field input__field--nao" type="text" name="number" placeholder="Enter Stream To Watch!"/>
5353
<label class="input__label input__label--nao" for="number">
@@ -187,6 +187,15 @@
187187
embed_code.appendChild(document.createTextNode(embed.outerHTML));
188188
}
189189

190+
function errWrap(fxn, form){
191+
try {
192+
return fxn(form);
193+
} catch(err) {
194+
alert("WebRTC is currently only supported by Chrome, Opera, and Firefox");
195+
return false;
196+
}
197+
}
198+
190199
</script>
191200

192201
<script>

0 commit comments

Comments
 (0)