Repository navigation
Expand file tree
/
Copy pathobsControl.html
More file actions
76 lines (65 loc) · 1.8 KB
/
Copy pathobsControl.html
File metadata and controls
76 lines (65 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="google" content="notranslate">
<meta http-equiv="Content-Language" content="en">
<!--
sim-ii: Copyright (C) 2019 VetSim, Cornell University College of Veterinary Medicine Ithaca, NY
See gpl.html -->
<title>OBS Control</title>
<script type="text/javascript" src="scripts/jquery/2.2.1/jquery.min.js"></script>
<script type="text/javascript" src="scripts/obs-websocket.js"></script>
<script>
function GetURLParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
};
//const OBSWebSocket = require('obs-websocket-js');
const obs = new OBSWebSocket();
$(document).ready(function() {
var cmd = GetURLParameter('command');
$("#cmd").append("command is "+cmd );
obs.connect().then(
function (){
$("#reply").append("ConnectOK\n " );
if ( cmd == 'start' )
{
obs.send('StartRecording').then(
function(){$("#reply").append("Sent Start\n " );},
function(result){$("#reply").append("Start Failed\n " ); console.log(result);} );
}
else if ( cmd == 'stop' )
{
obs.send('StopRecording').then(
function(){$("#reply").append("Sent Stop\n " );},
function(result){$("#reply").append("Stop Failed\n " ); console.log(result);} );
}
obs.disconnect();
},
function (result){
$("#reply").append("ConnectFailed\n " );
console.log(result);
})
.catch()
{
//$("#reply").append("Connect Error\n " );
};
});
</script>
</head>
<body>
<p>OBS Control</p>
<p id='cmd'></p>
<pre id='reply'></pre>
</body>
</html>