Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return recording link when recording is stoped #228

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ codesigning.asc
.DS_Store
webapp/src/main/webapp/
.vscode/

react/.env.development
react/.idea/workspace.xml
44 changes: 27 additions & 17 deletions react/src/pages/AntMedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,7 @@
displayMessage("Recording is about to stop...", "white")
var jsCmd = {
command: "stopRecording",
websocketURL: websocketURL,
streamId: roomName,
};

Expand Down Expand Up @@ -1221,20 +1222,7 @@
infoText += debugInfo;

//fake message to add chat
var obj = {
streamId: publishStreamId,
data: JSON.stringify({
eventType: "MESSAGE_RECEIVED",
name: "Debugger",
date: new Date().toLocaleTimeString([], {
hour: "2-digit",
minute: "2-digit",
}),
message: infoText,
}),
};

handleNotificationEvent(obj);
createFakeMessage(publishStreamId,infoText)

Check warning on line 1225 in react/src/pages/AntMedia.js

View check run for this annotation

Codecov / codecov/patch

react/src/pages/AntMedia.js#L1225

Added line #L1225 was not covered by tests
}

function toggleSetNumberOfUnreadMessages(numb) {
Expand Down Expand Up @@ -1809,6 +1797,22 @@
}
}, [isWebSocketConnected, sendMessage]);

function createFakeMessage(publishStreamId, infoText){
var msgobj = {

Check warning on line 1801 in react/src/pages/AntMedia.js

View check run for this annotation

Codecov / codecov/patch

react/src/pages/AntMedia.js#L1800-L1801

Added lines #L1800 - L1801 were not covered by tests
streamId: publishStreamId,
data: JSON.stringify({
eventType: "MESSAGE_RECEIVED",
name: "Recording",
date: new Date().toLocaleTimeString([], {
hour: "2-digit",
minute: "2-digit",
}),
message: infoText,
}),
};
handleNotificationEvent(msgobj);

Check warning on line 1813 in react/src/pages/AntMedia.js

View check run for this annotation

Codecov / codecov/patch

react/src/pages/AntMedia.js#L1813

Added line #L1813 was not covered by tests
}

React.useEffect(() => {
if (!latestMessage) {
return;
Expand Down Expand Up @@ -1845,12 +1849,18 @@
publishStreamId
);
displayMessage("Recording is stopped successfully", "white")
} else {
var recordingLink = definition.dataId;

Check warning on line 1852 in react/src/pages/AntMedia.js

View check run for this annotation

Codecov / codecov/patch

react/src/pages/AntMedia.js#L1852

Added line #L1852 was not covered by tests
if(recordingLink !== null && recordingLink !== undefined){
var infoText = "Recording is available on this link " + recordingLink;
createFakeMessage("Recording" ,infoText);

Check warning on line 1855 in react/src/pages/AntMedia.js

View check run for this annotation

Codecov / codecov/patch

react/src/pages/AntMedia.js#L1854-L1855

Added lines #L1854 - L1855 were not covered by tests
}
}
else {

Check warning on line 1858 in react/src/pages/AntMedia.js

View check run for this annotation

Codecov / codecov/patch

react/src/pages/AntMedia.js#L1858

Added line #L1858 was not covered by tests
console.log("Stop Recording is failed");
displayMessage("Recording cannot be stoped due to error: " + definition.message, "white")
}
}
}, [latestMessage, publishStreamId, displayMessage, handleSendNotificationEvent, updateRoomRecordingStatus]);
} // eslint-disable-next-line
},[latestMessage, publishStreamId, displayMessage, handleSendNotificationEvent, updateRoomRecordingStatus]);

const makeFullScreen = (divId) => {
if (fullScreenId === divId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,17 @@ public Result startRecording(String streamId, String websocketUrl, int width, in
return result;
}

public Result stopRecording(String streamId) {
public Result stopRecording(String streamId, String webURI) {
Result result = new Result(false);
try {
Method stopBroadcastingMethod = getMediaPushPlugin().getClass().getMethod("stopMediaPush", String.class);

URI websocketURLObject = new URI(webURI);
Method stopBroadcastingMethod = getMediaPushPlugin().getClass().getMethod("stopMediaPush", String.class,URI.class);

// Invoke stopBroadcasting
result = (Result) stopBroadcastingMethod.invoke(getMediaPushPlugin(), streamId);
result = (Result) stopBroadcastingMethod.invoke(getMediaPushPlugin(), streamId,websocketURLObject);

}
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e)
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | URISyntaxException e)
{
logger.error(ExceptionUtils.getStackTrace(e));
result.setMessage(e.getMessage());
Expand Down Expand Up @@ -272,11 +274,11 @@ else if (cmd.equals(WebSocketApplicationConstants.START_RECORDING_COMMAND)) {
else if (cmd.equals(WebSocketApplicationConstants.STOP_RECORDING_COMMAND))
{
String streamId = (String)jsonObject.get(WebSocketConstants.STREAM_ID);
String websocketUrl = (String) jsonObject.get(WebSocketApplicationConstants.WEBSOCKET_URL_FIELD);

logger.info("stop recording for {}", streamId);

String streamIdRecording = streamId + SUFFIX;
Result result = stopRecording(streamIdRecording);
String streamIdRecording = streamId + SUFFIX;Result result = stopRecording(streamIdRecording, websocketUrl);

JSONObject jsonObjectResponse = new JSONObject();
jsonObjectResponse.put(WebSocketConstants.COMMAND, WebSocketApplicationConstants.STOP_RECORDING_RESPONSE);
Expand Down