openvidu-recording tutorials updated to support 2.8.0
This commit is contained in:
parent
b79b6c7b81
commit
ba5602f370
@ -23,6 +23,7 @@ import io.openvidu.java.client.OpenViduHttpException;
|
||||
import io.openvidu.java.client.OpenViduJavaClientException;
|
||||
import io.openvidu.java.client.OpenViduRole;
|
||||
import io.openvidu.java.client.Recording;
|
||||
import io.openvidu.java.client.RecordingProperties;
|
||||
import io.openvidu.java.client.Session;
|
||||
import io.openvidu.java.client.TokenOptions;
|
||||
|
||||
@ -279,14 +280,22 @@ public class MyRestController {
|
||||
@RequestMapping(value = "/recording/start", method = RequestMethod.POST)
|
||||
public ResponseEntity<?> startRecording(@RequestBody String param) throws ParseException {
|
||||
JSONObject json = (JSONObject) new JSONParser().parse(param);
|
||||
String sessionId = (String) json.get("session");
|
||||
|
||||
System.out.println("Starting recording | {sessionId}=" + sessionId);
|
||||
String sessionId = (String) json.get("session");
|
||||
Recording.OutputMode outputMode = Recording.OutputMode.valueOf((String) json.get("outputMode"));
|
||||
boolean hasAudio = (boolean) json.get("hasAudio");
|
||||
boolean hasVideo = (boolean) json.get("hasVideo");
|
||||
|
||||
RecordingProperties properties = new RecordingProperties.Builder().outputMode(outputMode).hasAudio(hasAudio)
|
||||
.hasVideo(hasVideo).build();
|
||||
|
||||
System.out.println("Starting recording for session " + sessionId + " with properties {outputMode=" + outputMode
|
||||
+ ", hasAudio=" + hasAudio + ", hasVideo=" + hasVideo + "}");
|
||||
|
||||
try {
|
||||
Recording recording = this.openVidu.startRecording(sessionId);
|
||||
Recording recording = this.openVidu.startRecording(sessionId, properties);
|
||||
this.sessionRecordings.put(sessionId, true);
|
||||
return new ResponseEntity<>(getJsonFromRecording(recording), HttpStatus.OK);
|
||||
return new ResponseEntity<>(recording, HttpStatus.OK);
|
||||
} catch (OpenViduJavaClientException | OpenViduHttpException e) {
|
||||
return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
@ -302,7 +311,7 @@ public class MyRestController {
|
||||
try {
|
||||
Recording recording = this.openVidu.stopRecording(recordingId);
|
||||
this.sessionRecordings.remove(recording.getSessionId());
|
||||
return new ResponseEntity<>(getJsonFromRecording(recording), HttpStatus.OK);
|
||||
return new ResponseEntity<>(recording, HttpStatus.OK);
|
||||
} catch (OpenViduJavaClientException | OpenViduHttpException e) {
|
||||
return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
@ -330,7 +339,7 @@ public class MyRestController {
|
||||
|
||||
try {
|
||||
Recording recording = this.openVidu.getRecording(recordingId);
|
||||
return new ResponseEntity<>(getJsonFromRecording(recording), HttpStatus.OK);
|
||||
return new ResponseEntity<>(recording, HttpStatus.OK);
|
||||
} catch (OpenViduJavaClientException | OpenViduHttpException e) {
|
||||
return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
@ -344,7 +353,7 @@ public class MyRestController {
|
||||
try {
|
||||
List<Recording> recordings = this.openVidu.listRecordings();
|
||||
|
||||
return new ResponseEntity<>(getJsonArrayFromRecordingList(recordings), HttpStatus.OK);
|
||||
return new ResponseEntity<>(recordings, HttpStatus.OK);
|
||||
} catch (OpenViduJavaClientException | OpenViduHttpException e) {
|
||||
return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
@ -359,32 +368,6 @@ public class MyRestController {
|
||||
return new ResponseEntity<>(json, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private JSONObject getJsonFromRecording(Recording recording) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("createdAt", recording.getCreatedAt());
|
||||
json.put("duration", recording.getDuration());
|
||||
json.put("hasAudio", recording.hasAudio());
|
||||
json.put("hasVideo", recording.hasVideo());
|
||||
json.put("id", recording.getId());
|
||||
json.put("recordingLayout", recording.getRecordingLayout());
|
||||
json.put("name", recording.getName());
|
||||
json.put("sessionId", recording.getSessionId());
|
||||
json.put("size", recording.getSize());
|
||||
json.put("status", recording.getStatus());
|
||||
json.put("url", recording.getUrl());
|
||||
return json;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private JSONArray getJsonArrayFromRecordingList(Collection<Recording> recordings) {
|
||||
JSONArray array = new JSONArray();
|
||||
for (Recording recording : recordings) {
|
||||
array.add(getJsonFromRecording(recording));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected JSONObject sessionToJson(Session session) {
|
||||
JSONObject json = new JSONObject();
|
||||
|
||||
@ -124,8 +124,9 @@ function getToken(callback) {
|
||||
|
||||
httpRequest(
|
||||
'POST',
|
||||
'api/get-token',
|
||||
{ sessionName: sessionName },
|
||||
'api/get-token', {
|
||||
sessionName: sessionName
|
||||
},
|
||||
'Request of TOKEN gone WRONG:',
|
||||
(response) => {
|
||||
token = response[0]; // Get token from response
|
||||
@ -138,8 +139,10 @@ function getToken(callback) {
|
||||
function removeUser() {
|
||||
httpRequest(
|
||||
'POST',
|
||||
'api/remove-user',
|
||||
{ sessionName: sessionName, token: token },
|
||||
'api/remove-user', {
|
||||
sessionName: sessionName,
|
||||
token: token
|
||||
},
|
||||
'User couldn\'t be removed from session',
|
||||
(response) => {
|
||||
console.warn("You have been removed from session " + sessionName);
|
||||
@ -150,8 +153,9 @@ function removeUser() {
|
||||
function closeSession() {
|
||||
httpRequest(
|
||||
'DELETE',
|
||||
'api/close-session',
|
||||
{ sessionName: sessionName },
|
||||
'api/close-session', {
|
||||
sessionName: sessionName
|
||||
},
|
||||
'Session couldn\'t be closed',
|
||||
(response) => {
|
||||
console.warn("Session " + sessionName + " has been closed");
|
||||
@ -162,8 +166,9 @@ function closeSession() {
|
||||
function fetchInfo() {
|
||||
httpRequest(
|
||||
'POST',
|
||||
'api/fetch-info',
|
||||
{ sessionName: sessionName },
|
||||
'api/fetch-info', {
|
||||
sessionName: sessionName
|
||||
},
|
||||
'Session couldn\'t be fetched',
|
||||
(response) => {
|
||||
console.warn("Session info has been fetched");
|
||||
@ -175,8 +180,7 @@ function fetchInfo() {
|
||||
function fetchAll() {
|
||||
httpRequest(
|
||||
'GET',
|
||||
'api/fetch-all',
|
||||
{},
|
||||
'api/fetch-all', {},
|
||||
'All session info couldn\'t be fetched',
|
||||
(response) => {
|
||||
console.warn("All session info has been fetched");
|
||||
@ -188,8 +192,10 @@ function fetchAll() {
|
||||
function forceDisconnect() {
|
||||
httpRequest(
|
||||
'DELETE',
|
||||
'api/force-disconnect',
|
||||
{ sessionName: sessionName, connectionId: document.getElementById('forceValue').value },
|
||||
'api/force-disconnect', {
|
||||
sessionName: sessionName,
|
||||
connectionId: document.getElementById('forceValue').value
|
||||
},
|
||||
'Connection couldn\'t be closed',
|
||||
(response) => {
|
||||
console.warn("Connection has been closed");
|
||||
@ -200,8 +206,10 @@ function forceDisconnect() {
|
||||
function forceUnpublish() {
|
||||
httpRequest(
|
||||
'DELETE',
|
||||
'api/force-unpublish',
|
||||
{ sessionName: sessionName, streamId: document.getElementById('forceValue').value },
|
||||
'api/force-unpublish', {
|
||||
sessionName: sessionName,
|
||||
streamId: document.getElementById('forceValue').value
|
||||
},
|
||||
'Stream couldn\'t be closed',
|
||||
(response) => {
|
||||
console.warn("Stream has been closed");
|
||||
@ -235,10 +243,17 @@ function httpRequest(method, url, body, errorMsg, callback) {
|
||||
}
|
||||
|
||||
function startRecording() {
|
||||
var outputMode = document.querySelector('input[name="outputMode"]:checked').value;
|
||||
var hasAudio = !!document.querySelector("#has-audio-checkbox:checked");
|
||||
var hasVideo = !!document.querySelector("#has-video-checkbox:checked");
|
||||
httpRequest(
|
||||
'POST',
|
||||
'api/recording/start',
|
||||
{ session: session.sessionId },
|
||||
'api/recording/start', {
|
||||
session: session.sessionId,
|
||||
outputMode: outputMode,
|
||||
hasAudio: hasAudio,
|
||||
hasVideo: hasVideo
|
||||
},
|
||||
'Start recording WRONG',
|
||||
(response) => {
|
||||
console.log(response);
|
||||
@ -253,8 +268,9 @@ function stopRecording() {
|
||||
var forceRecordingId = document.getElementById('forceRecordingId').value;
|
||||
httpRequest(
|
||||
'POST',
|
||||
'api/recording/stop',
|
||||
{ recording: forceRecordingId },
|
||||
'api/recording/stop', {
|
||||
recording: forceRecordingId
|
||||
},
|
||||
'Stop recording WRONG',
|
||||
(response) => {
|
||||
console.log(response);
|
||||
@ -267,8 +283,9 @@ function deleteRecording() {
|
||||
var forceRecordingId = document.getElementById('forceRecordingId').value;
|
||||
httpRequest(
|
||||
'DELETE',
|
||||
'api/recording/delete',
|
||||
{ recording: forceRecordingId },
|
||||
'api/recording/delete', {
|
||||
recording: forceRecordingId
|
||||
},
|
||||
'Delete recording WRONG',
|
||||
() => {
|
||||
console.log("DELETE ok");
|
||||
@ -281,8 +298,7 @@ function getRecording() {
|
||||
var forceRecordingId = document.getElementById('forceRecordingId').value;
|
||||
httpRequest(
|
||||
'GET',
|
||||
'api/recording/get/' + forceRecordingId,
|
||||
{},
|
||||
'api/recording/get/' + forceRecordingId, {},
|
||||
'Get recording WRONG',
|
||||
(response) => {
|
||||
console.log(response);
|
||||
@ -294,8 +310,7 @@ function getRecording() {
|
||||
function listRecordings() {
|
||||
httpRequest(
|
||||
'GET',
|
||||
'api/recording/list',
|
||||
{},
|
||||
'api/recording/list', {},
|
||||
'List recordings WRONG',
|
||||
(response) => {
|
||||
console.log(response);
|
||||
|
||||
@ -39,7 +39,8 @@
|
||||
title="GitHub Repository" target="_blank">
|
||||
<i class="fa fa-github" aria-hidden="true"></i>
|
||||
</a>
|
||||
<a class="navbar-brand nav-icon" href="http://www.openvidu.io/docs/tutorials/openvidu-js-java/" title="Documentation" target="_blank">
|
||||
<a class="navbar-brand nav-icon" href="http://www.openvidu.io/docs/tutorials/openvidu-js-java/" title="Documentation"
|
||||
target="_blank">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
@ -70,24 +71,49 @@
|
||||
<div id="session-header">
|
||||
<h1 id="session-title"></h1>
|
||||
<input class="btn btn-sm btn-danger" type="button" id="buttonCloseSession" onmouseup="closeSession()" value="Close session">
|
||||
<input class="btn btn-sm btn-danger" type="button" id="buttonLeaveSession" onmouseup="removeUser(); leaveSession()" value="Leave session">
|
||||
<input class="btn btn-sm" type="button" id="buttonForceUnpublish" onmouseup="forceUnpublish()" value="Force unpublish" disabled>
|
||||
<input class="btn btn-sm btn-danger" type="button" id="buttonLeaveSession" onmouseup="removeUser(); leaveSession()"
|
||||
value="Leave session">
|
||||
<div class="vertical-separator-top"></div>
|
||||
<input class="form-control" id="forceValue" type="text" onkeyup="checkBtnsForce()">
|
||||
<input class="btn btn-sm" type="button" id="buttonForceUnpublish" onmouseup="forceUnpublish()" value="Force unpublish"
|
||||
disabled>
|
||||
<input class="btn btn-sm" type="button" id="buttonForceDisconnect" onmouseup="forceDisconnect()" value="Force disconnect"
|
||||
disabled>
|
||||
<input class="form-control" id="forceValue" type="text" onkeyup="checkBtnsForce()">
|
||||
<div class="vertical-separator-top"></div>
|
||||
<input class="btn btn-sm" type="button" id="buttonFetchInfo" onmouseup="fetchInfo()" value="Fetch info">
|
||||
<input class="btn btn-sm" type="button" id="buttonFetchAll" onmouseup="fetchAll()" value="Fetch all">
|
||||
</div>
|
||||
<div id="video-container" class="col-md-12"></div>
|
||||
<div id="recording-btns">
|
||||
<div id="btns">
|
||||
<div class="btns">
|
||||
<input class="btn btn-md" type="button" id="buttonStartRecording" onmouseup="startRecording()" value="Start recording">
|
||||
<form>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="outputMode" value="COMPOSED" checked>COMPOSED
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="outputMode" value="INDIVIDUAL">INDIVIDUAL
|
||||
</label>
|
||||
</form>
|
||||
<form>
|
||||
<label class="checkbox-inline">
|
||||
<input type="checkbox" id="has-audio-checkbox" checked>Has audio
|
||||
</label>
|
||||
<label class="checkbox-inline">
|
||||
<input type="checkbox" id="has-video-checkbox" checked>Has video
|
||||
</label>
|
||||
</form>
|
||||
</div>
|
||||
<div class="btns">
|
||||
<input class="btn btn-md" type="button" id="buttonListRecording" onmouseup="listRecordings()" value="List recordings">
|
||||
<input class="form-control" id="forceRecordingId" type="text" onkeyup="checkBtnsRecordings()">
|
||||
<input class="btn btn-md" type="button" id="buttonGetRecording" onmouseup="getRecording()" value="Get recording" disabled>
|
||||
<input class="btn btn-md" type="button" id="buttonStopRecording" onmouseup="stopRecording()" value="Stop recording" disabled>
|
||||
<div class="vertical-separator-bottom"></div>
|
||||
<input class="btn btn-md" type="button" id="buttonGetRecording" onmouseup="getRecording()" value="Get recording"
|
||||
disabled>
|
||||
<input class="btn btn-md" type="button" id="buttonStopRecording" onmouseup="stopRecording()" value="Stop recording"
|
||||
disabled>
|
||||
<input class="btn btn-md" type="button" id="buttonDeleteRecording" onmouseup="deleteRecording()" value="Delete recording"
|
||||
disabled>
|
||||
<input class="form-control" id="forceRecordingId" type="text" onkeyup="checkBtnsRecordings()">
|
||||
</div>
|
||||
<textarea id="text-area" readonly="true" class="form-control" name="comment">HTTP responses...</textarea>
|
||||
</div>
|
||||
|
||||
@ -229,7 +229,7 @@ a:hover .demo-logo {
|
||||
}
|
||||
|
||||
#session-header form {
|
||||
display: inline;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#session-header input.btn {
|
||||
@ -360,47 +360,75 @@ table i {
|
||||
height: 40%;
|
||||
}
|
||||
|
||||
#recording-btns #btns {
|
||||
#recording-btns .btns {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#recording-btns #btns .form-control {
|
||||
#recording-btns .btns .form-control {
|
||||
width: initial;
|
||||
display: inline-block;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#recording-btns .btns form {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#recording-btns #text-area {
|
||||
display: inline-block;
|
||||
display: inline;
|
||||
width: 100%;
|
||||
height: 80%;
|
||||
height: 74%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.vertical-separator-bottom {
|
||||
width: 2px;
|
||||
height: 34px;
|
||||
display: inline;
|
||||
background-color: #cbcbcb;
|
||||
margin: 0 8px 0 8px;
|
||||
margin-bottom: -12px;
|
||||
}
|
||||
|
||||
.vertical-separator-top {
|
||||
width: 2px;
|
||||
height: 30px;
|
||||
background-color: #cbcbcb;
|
||||
margin: 20px 8px 0 15px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* xs ans md screen resolutions*/
|
||||
|
||||
@media screen and (max-width: 991px) {
|
||||
#join {
|
||||
padding-top: inherit;
|
||||
}
|
||||
|
||||
#not-logged {
|
||||
padding-top: inherit;
|
||||
}
|
||||
|
||||
.container .navbar-header {
|
||||
margin-right: 0 !important;
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
.nav-icon {
|
||||
padding: 9px 8px 9px 8px;
|
||||
}
|
||||
|
||||
nav i.fa {
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
.vertical-center {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
#img-div {
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
#img-div img {
|
||||
height: 10%;
|
||||
}
|
||||
|
||||
@ -124,8 +124,9 @@ function getToken(callback) {
|
||||
|
||||
httpRequest(
|
||||
'POST',
|
||||
'api/get-token',
|
||||
{ sessionName: sessionName },
|
||||
'api/get-token', {
|
||||
sessionName: sessionName
|
||||
},
|
||||
'Request of TOKEN gone WRONG:',
|
||||
(response) => {
|
||||
token = response[0]; // Get token from response
|
||||
@ -138,8 +139,10 @@ function getToken(callback) {
|
||||
function removeUser() {
|
||||
httpRequest(
|
||||
'POST',
|
||||
'api/remove-user',
|
||||
{ sessionName: sessionName, token: token },
|
||||
'api/remove-user', {
|
||||
sessionName: sessionName,
|
||||
token: token
|
||||
},
|
||||
'User couldn\'t be removed from session',
|
||||
(response) => {
|
||||
console.warn("You have been removed from session " + sessionName);
|
||||
@ -150,8 +153,9 @@ function removeUser() {
|
||||
function closeSession() {
|
||||
httpRequest(
|
||||
'DELETE',
|
||||
'api/close-session',
|
||||
{ sessionName: sessionName },
|
||||
'api/close-session', {
|
||||
sessionName: sessionName
|
||||
},
|
||||
'Session couldn\'t be closed',
|
||||
(response) => {
|
||||
console.warn("Session " + sessionName + " has been closed");
|
||||
@ -162,8 +166,9 @@ function closeSession() {
|
||||
function fetchInfo() {
|
||||
httpRequest(
|
||||
'POST',
|
||||
'api/fetch-info',
|
||||
{ sessionName: sessionName },
|
||||
'api/fetch-info', {
|
||||
sessionName: sessionName
|
||||
},
|
||||
'Session couldn\'t be fetched',
|
||||
(response) => {
|
||||
console.warn("Session info has been fetched");
|
||||
@ -175,8 +180,7 @@ function fetchInfo() {
|
||||
function fetchAll() {
|
||||
httpRequest(
|
||||
'GET',
|
||||
'api/fetch-all',
|
||||
{},
|
||||
'api/fetch-all', {},
|
||||
'All session info couldn\'t be fetched',
|
||||
(response) => {
|
||||
console.warn("All session info has been fetched");
|
||||
@ -188,8 +192,10 @@ function fetchAll() {
|
||||
function forceDisconnect() {
|
||||
httpRequest(
|
||||
'DELETE',
|
||||
'api/force-disconnect',
|
||||
{ sessionName: sessionName, connectionId: document.getElementById('forceValue').value },
|
||||
'api/force-disconnect', {
|
||||
sessionName: sessionName,
|
||||
connectionId: document.getElementById('forceValue').value
|
||||
},
|
||||
'Connection couldn\'t be closed',
|
||||
(response) => {
|
||||
console.warn("Connection has been closed");
|
||||
@ -200,8 +206,10 @@ function forceDisconnect() {
|
||||
function forceUnpublish() {
|
||||
httpRequest(
|
||||
'DELETE',
|
||||
'api/force-unpublish',
|
||||
{ sessionName: sessionName, streamId: document.getElementById('forceValue').value },
|
||||
'api/force-unpublish', {
|
||||
sessionName: sessionName,
|
||||
streamId: document.getElementById('forceValue').value
|
||||
},
|
||||
'Stream couldn\'t be closed',
|
||||
(response) => {
|
||||
console.warn("Stream has been closed");
|
||||
@ -235,10 +243,17 @@ function httpRequest(method, url, body, errorMsg, callback) {
|
||||
}
|
||||
|
||||
function startRecording() {
|
||||
var outputMode = document.querySelector('input[name="outputMode"]:checked').value;
|
||||
var hasAudio = !!document.querySelector("#has-audio-checkbox:checked");
|
||||
var hasVideo = !!document.querySelector("#has-video-checkbox:checked");
|
||||
httpRequest(
|
||||
'POST',
|
||||
'api/recording/start',
|
||||
{ session: session.sessionId },
|
||||
'api/recording/start', {
|
||||
session: session.sessionId,
|
||||
outputMode: outputMode,
|
||||
hasAudio: hasAudio,
|
||||
hasVideo: hasVideo
|
||||
},
|
||||
'Start recording WRONG',
|
||||
(response) => {
|
||||
console.log(response);
|
||||
@ -253,8 +268,9 @@ function stopRecording() {
|
||||
var forceRecordingId = document.getElementById('forceRecordingId').value;
|
||||
httpRequest(
|
||||
'POST',
|
||||
'api/recording/stop',
|
||||
{ recording: forceRecordingId },
|
||||
'api/recording/stop', {
|
||||
recording: forceRecordingId
|
||||
},
|
||||
'Stop recording WRONG',
|
||||
(response) => {
|
||||
console.log(response);
|
||||
@ -267,8 +283,9 @@ function deleteRecording() {
|
||||
var forceRecordingId = document.getElementById('forceRecordingId').value;
|
||||
httpRequest(
|
||||
'DELETE',
|
||||
'api/recording/delete',
|
||||
{ recording: forceRecordingId },
|
||||
'api/recording/delete', {
|
||||
recording: forceRecordingId
|
||||
},
|
||||
'Delete recording WRONG',
|
||||
() => {
|
||||
console.log("DELETE ok");
|
||||
@ -281,8 +298,7 @@ function getRecording() {
|
||||
var forceRecordingId = document.getElementById('forceRecordingId').value;
|
||||
httpRequest(
|
||||
'GET',
|
||||
'api/recording/get/' + forceRecordingId,
|
||||
{},
|
||||
'api/recording/get/' + forceRecordingId, {},
|
||||
'Get recording WRONG',
|
||||
(response) => {
|
||||
console.log(response);
|
||||
@ -294,8 +310,7 @@ function getRecording() {
|
||||
function listRecordings() {
|
||||
httpRequest(
|
||||
'GET',
|
||||
'api/recording/list',
|
||||
{},
|
||||
'api/recording/list', {},
|
||||
'List recordings WRONG',
|
||||
(response) => {
|
||||
console.log(response);
|
||||
|
||||
@ -39,7 +39,8 @@
|
||||
title="GitHub Repository" target="_blank">
|
||||
<i class="fa fa-github" aria-hidden="true"></i>
|
||||
</a>
|
||||
<a class="navbar-brand nav-icon" href="http://www.openvidu.io/docs/tutorials/openvidu-js-node/" title="Documentation" target="_blank">
|
||||
<a class="navbar-brand nav-icon" href="http://www.openvidu.io/docs/tutorials/openvidu-js-node/" title="Documentation"
|
||||
target="_blank">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
@ -70,24 +71,49 @@
|
||||
<div id="session-header">
|
||||
<h1 id="session-title"></h1>
|
||||
<input class="btn btn-sm btn-danger" type="button" id="buttonCloseSession" onmouseup="closeSession()" value="Close session">
|
||||
<input class="btn btn-sm btn-danger" type="button" id="buttonLeaveSession" onmouseup="removeUser(); leaveSession()" value="Leave session">
|
||||
<input class="btn btn-sm" type="button" id="buttonForceUnpublish" onmouseup="forceUnpublish()" value="Force unpublish" disabled>
|
||||
<input class="btn btn-sm btn-danger" type="button" id="buttonLeaveSession" onmouseup="removeUser(); leaveSession()"
|
||||
value="Leave session">
|
||||
<div class="vertical-separator-top"></div>
|
||||
<input class="form-control" id="forceValue" type="text" onkeyup="checkBtnsForce()">
|
||||
<input class="btn btn-sm" type="button" id="buttonForceUnpublish" onmouseup="forceUnpublish()" value="Force unpublish"
|
||||
disabled>
|
||||
<input class="btn btn-sm" type="button" id="buttonForceDisconnect" onmouseup="forceDisconnect()" value="Force disconnect"
|
||||
disabled>
|
||||
<input class="form-control" id="forceValue" type="text" onkeyup="checkBtnsForce()">
|
||||
<div class="vertical-separator-top"></div>
|
||||
<input class="btn btn-sm" type="button" id="buttonFetchInfo" onmouseup="fetchInfo()" value="Fetch info">
|
||||
<input class="btn btn-sm" type="button" id="buttonFetchAll" onmouseup="fetchAll()" value="Fetch all">
|
||||
</div>
|
||||
<div id="video-container" class="col-md-12"></div>
|
||||
<div id="recording-btns">
|
||||
<div id="btns">
|
||||
<div class="btns">
|
||||
<input class="btn btn-md" type="button" id="buttonStartRecording" onmouseup="startRecording()" value="Start recording">
|
||||
<form>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="outputMode" value="COMPOSED" checked>COMPOSED
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="outputMode" value="INDIVIDUAL">INDIVIDUAL
|
||||
</label>
|
||||
</form>
|
||||
<form>
|
||||
<label class="checkbox-inline">
|
||||
<input type="checkbox" id="has-audio-checkbox" checked>Has audio
|
||||
</label>
|
||||
<label class="checkbox-inline">
|
||||
<input type="checkbox" id="has-video-checkbox" checked>Has video
|
||||
</label>
|
||||
</form>
|
||||
</div>
|
||||
<div class="btns">
|
||||
<input class="btn btn-md" type="button" id="buttonListRecording" onmouseup="listRecordings()" value="List recordings">
|
||||
<input class="form-control" id="forceRecordingId" type="text" onkeyup="checkBtnsRecordings()">
|
||||
<input class="btn btn-md" type="button" id="buttonGetRecording" onmouseup="getRecording()" value="Get recording" disabled>
|
||||
<input class="btn btn-md" type="button" id="buttonStopRecording" onmouseup="stopRecording()" value="Stop recording" disabled>
|
||||
<div class="vertical-separator-bottom"></div>
|
||||
<input class="btn btn-md" type="button" id="buttonGetRecording" onmouseup="getRecording()" value="Get recording"
|
||||
disabled>
|
||||
<input class="btn btn-md" type="button" id="buttonStopRecording" onmouseup="stopRecording()" value="Stop recording"
|
||||
disabled>
|
||||
<input class="btn btn-md" type="button" id="buttonDeleteRecording" onmouseup="deleteRecording()" value="Delete recording"
|
||||
disabled>
|
||||
<input class="form-control" id="forceRecordingId" type="text" onkeyup="checkBtnsRecordings()">
|
||||
</div>
|
||||
<textarea id="text-area" readonly="true" class="form-control" name="comment">HTTP responses...</textarea>
|
||||
</div>
|
||||
|
||||
@ -229,7 +229,7 @@ a:hover .demo-logo {
|
||||
}
|
||||
|
||||
#session-header form {
|
||||
display: inline;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#session-header input.btn {
|
||||
@ -360,47 +360,75 @@ table i {
|
||||
height: 40%;
|
||||
}
|
||||
|
||||
#recording-btns #btns {
|
||||
#recording-btns .btns {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#recording-btns #btns .form-control {
|
||||
#recording-btns .btns .form-control {
|
||||
width: initial;
|
||||
display: inline-block;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#recording-btns .btns form {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#recording-btns #text-area {
|
||||
display: inline-block;
|
||||
display: inline;
|
||||
width: 100%;
|
||||
height: 80%;
|
||||
height: 74%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.vertical-separator-bottom {
|
||||
width: 2px;
|
||||
height: 34px;
|
||||
display: inline;
|
||||
background-color: #cbcbcb;
|
||||
margin: 0 8px 0 8px;
|
||||
margin-bottom: -12px;
|
||||
}
|
||||
|
||||
.vertical-separator-top {
|
||||
width: 2px;
|
||||
height: 30px;
|
||||
background-color: #cbcbcb;
|
||||
margin: 20px 8px 0 15px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* xs ans md screen resolutions*/
|
||||
|
||||
@media screen and (max-width: 991px) {
|
||||
#join {
|
||||
padding-top: inherit;
|
||||
}
|
||||
|
||||
#not-logged {
|
||||
padding-top: inherit;
|
||||
}
|
||||
|
||||
.container .navbar-header {
|
||||
margin-right: 0 !important;
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
.nav-icon {
|
||||
padding: 9px 8px 9px 8px;
|
||||
}
|
||||
|
||||
nav i.fa {
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
.vertical-center {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
#img-div {
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
#img-div img {
|
||||
height: 10%;
|
||||
}
|
||||
|
||||
@ -68,7 +68,9 @@ app.post('/api/get-token', function (req, res) {
|
||||
console.log("Getting a token | {sessionName}={" + sessionName + "}");
|
||||
|
||||
// Build tokenOptions object with PUBLISHER role
|
||||
var tokenOptions = { role: role }
|
||||
var tokenOptions = {
|
||||
role: role
|
||||
}
|
||||
|
||||
if (mapSessions[sessionName]) {
|
||||
// Session already exists
|
||||
@ -258,11 +260,16 @@ app.delete('/api/force-unpublish', function (req, res) {
|
||||
// Start recording
|
||||
app.post('/api/recording/start', function (req, res) {
|
||||
// Retrieve params from POST body
|
||||
var recordingProperties = {
|
||||
outputMode: req.body.outputMode,
|
||||
hasAudio: req.body.hasAudio,
|
||||
hasVideo: req.body.hasVideo,
|
||||
}
|
||||
var sessionId = req.body.session;
|
||||
console.log("Starting recording | {sessionId}=" + sessionId);
|
||||
|
||||
OV.startRecording(sessionId)
|
||||
.then(recording => res.status(200).send(getJsonFromRecording(recording)))
|
||||
OV.startRecording(sessionId, recordingProperties)
|
||||
.then(recording => res.status(200).send(recording))
|
||||
.catch(error => res.status(400).send(error.message));
|
||||
});
|
||||
|
||||
@ -273,7 +280,7 @@ app.post('/api/recording/stop', function (req, res) {
|
||||
console.log("Stopping recording | {recordingId}=" + recordingId);
|
||||
|
||||
OV.stopRecording(recordingId)
|
||||
.then(recording => res.status(200).send(getJsonFromRecording(recording)))
|
||||
.then(recording => res.status(200).send(recording))
|
||||
.catch(error => res.status(400).send(error.message));
|
||||
});
|
||||
|
||||
@ -295,7 +302,7 @@ app.get('/api/recording/get/:recordingId', function (req, res) {
|
||||
console.log("Getting recording | {recordingId}=" + recordingId);
|
||||
|
||||
OV.getRecording(recordingId)
|
||||
.then(recording => res.status(200).send(getJsonFromRecording(recording)))
|
||||
.then(recording => res.status(200).send(recording))
|
||||
.catch(error => res.status(400).send(error.message));
|
||||
});
|
||||
|
||||
@ -304,34 +311,10 @@ app.get('/api/recording/list', function (req, res) {
|
||||
console.log("Listing recordings");
|
||||
|
||||
OV.listRecordings()
|
||||
.then(recordings => res.status(200).send(getJsonArrayFromRecordingList(recordings)))
|
||||
.then(recordings => res.status(200).send(recordings))
|
||||
.catch(error => res.status(400).send(error.message));
|
||||
});
|
||||
|
||||
function getJsonFromRecording(recording) {
|
||||
return {
|
||||
"createdAt": recording.createdAt,
|
||||
"duration": recording.duration,
|
||||
"hasAudio": recording.hasAudio,
|
||||
"hasVideo": recording.hasVideo,
|
||||
"id": recording.id,
|
||||
"name": recording.name,
|
||||
"recordingLayout": recording.recordingLayout,
|
||||
"sessionId": recording.sessionId,
|
||||
"size": recording.size,
|
||||
"status": recording.status,
|
||||
"url": recording.url
|
||||
}
|
||||
}
|
||||
|
||||
function getJsonArrayFromRecordingList(recordings) {
|
||||
var jsonArray = [];
|
||||
recordings.forEach(recording => {
|
||||
jsonArray.push(getJsonFromRecording(recording));
|
||||
})
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
function sessionToJson(session) {
|
||||
var json = {};
|
||||
json.sessionId = session.sessionId;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user