added new path /webrtc for testing purposes
This commit is contained in:
54
nodejs/views/webrtc.ejs
Normal file
54
nodejs/views/webrtc.ejs
Normal file
@@ -0,0 +1,54 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width initial-scale=1" />
|
||||
<link href="stylesheets/safechat.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="jquery/jquery.min.js"></script>
|
||||
<link href="stylesheets/jquery.cssemoticons.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<script src="javascripts/ext/jquery.cssemoticons.js" type="text/javascript"></script>
|
||||
<title>WebRTC Test</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>WebRTC test</h1>
|
||||
<div id="status">
|
||||
<div id="main">
|
||||
<noscript>JavaScript is required!</noscript>
|
||||
<video autoplay></video>
|
||||
</div>
|
||||
<script>
|
||||
try {
|
||||
var errorCallback = function(e) {
|
||||
$('#status').html('ERROR: '+e)
|
||||
console.log('ERROR:', e)
|
||||
}
|
||||
navigator.getUserMedia = navigator.getUserMedia ||
|
||||
navigator.webkitGetUserMedia ||
|
||||
navigator.mozGetUserMedia ||
|
||||
navigator.msGetUserMedia
|
||||
if (navigator.getUserMedia) {
|
||||
// Not showing vendor prefixes.
|
||||
navigator.getUserMedia({
|
||||
video: true,
|
||||
audio: true,
|
||||
facingMode: "user"
|
||||
}, function(localMediaStream) {
|
||||
var video = document.querySelector('video')
|
||||
video.src = window.URL.createObjectURL(localMediaStream)
|
||||
|
||||
// Note: onloadedmetadata doesn't fire in Chrome when using it with getUserMedia.
|
||||
// See crbug.com/110938.
|
||||
video.onloadedmetadata = function(e) {
|
||||
// Ready to go. Do some stuff.
|
||||
};
|
||||
}, errorCallback)
|
||||
} else {
|
||||
$('#status').html('ERROR: WebRTC not fully supported in this browser')
|
||||
}
|
||||
} catch (e) {
|
||||
$('#status').html('ERROR: '+e.message)
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user