Skip to content

Commit

Permalink
Refs #245. Added blur option in service config form and shared object.
Browse files Browse the repository at this point in the history
  • Loading branch information
SBriere committed Oct 16, 2024
1 parent 3ed9f02 commit 93b2ff5
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 34 deletions.
9 changes: 5 additions & 4 deletions teraserver/easyrtc/static/js/tera_processing.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
let unblurredTrack = undefined;

// Blur local video. Only first local stream is supported for now.
function blur(enable = true) {
function blur(enable = true, refresh_stream = false) {
if ( (enable && unblurredTrack !== undefined) || (!enable && unblurredTrack === undefined)) {
console.error("Blur: Can't unblur or blur a stream that's already blurred or unblurred.")
//console.error("Blur: Can't unblur or blur a stream that's already blurred or unblurred.")
return;
}

Expand Down Expand Up @@ -54,7 +54,7 @@ function blur(enable = true) {

// Only overwrite missing pixels.
ctx.globalCompositeOperation = "destination-atop";
ctx.filter = `blur(16px)`;
ctx.filter = `blur(10px)`;
ctx.drawImage(
results.image,
0,
Expand Down Expand Up @@ -89,5 +89,6 @@ function blur(enable = true) {
processedStream.removeTrack(unblurredTrack);
processedStream.addTrack(trackGenerator);
}
localVideoStreamSuccess(localStreams[0].stream);
if (refresh_stream)
localVideoStreamSuccess(localStreams[0].stream);
}
8 changes: 8 additions & 0 deletions teraserver/easyrtc/static/js/tera_shared_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ function setupSharedObjectCallbacks(channel){
channel.objects.SharedObject.newDataForward.connect(forwardData);
channel.objects.SharedObject.newSecondSources.connect(selectSecondarySources);
channel.objects.SharedObject.setLocalMirrorSignal.connect(setLocalMirror);
if (channel.objects.SharedObject.setLocalBlurSignal !== undefined)
channel.objects.SharedObject.setLocalBlurSignal.connect(setLocalBlur);

if (channel.objects.SharedObject.videoSourceRemoved !== undefined)
channel.objects.SharedObject.videoSourceRemoved.connect(removeVideoSource);
Expand All @@ -65,6 +67,7 @@ function setupSharedObjectCallbacks(channel){
selectAudioSource(settings.audio);
selectVideoSource(settings.video);
setLocalMirror(settings.mirror);
setLocalBlur(settings.blur);
selectSecondarySources(settings.secondAudioVideo);
ptz = JSON.parse(settings.ptz);
setPTZCapabilities(localContact.uuid, ptz.zoom, ptz.presets, ptz.settings, ptz.camera);
Expand Down Expand Up @@ -94,6 +97,11 @@ function setLocalMirror(mirror){
setMirror(mirror, true, 1);
}

function setLocalBlur(blur_value){
console.log("setLocalBlur = " + blur_value);
currentConfig["video1Blur"] = blur_value;
}

function startRecordingRequest(){
if (!streamRecorder)
streamRecorder = new TeraVideoRecorder();
Expand Down
5 changes: 4 additions & 1 deletion teraserver/easyrtc/static/js/tera_webrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,14 +437,17 @@ function localVideoStreamSuccess(stream){
});
}
}

}
easyrtc.setVideoObjectSrc(getVideoWidget(true, local_index+1)[0], stream);

// Update status icons
easyrtc.enableMicrophone(!localContact.status.microMuted)
updateStatusIconState(!localContact.status.microMuted, true, local_index+1, 'Mic');
updateStatusIconState(true, true, local_index+1, 'Video');
if (local_index === 0){
unblurredTrack = undefined;
blur(currentConfig.video1Blur, false);
}

}else{
console.log("Got local stream - waiting for it to become active...");
Expand Down
1 change: 1 addition & 0 deletions teraserver/python/opentera/forms/TeraServiceConfigForm.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def get_service_config_config_form(service_key: str):
# Items
section1.add_item(TeraFormItem("camera", gettext("Camera"), "videoinputs", False))
section1.add_item(TeraFormItem("mirror", gettext("Mirrored image"), "boolean", False, item_default=True))
section1.add_item(TeraFormItem("blur", gettext("Blurred background"), "boolean", False, item_default=False))

item = TeraFormItem("teracam_src", gettext("URL"), "text", True,
item_condition=TeraFormItemCondition("camera", "=", "OpenTeraCam"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-07 15:05-0400\n"
"POT-Creation-Date: 2024-10-16 10:12-0400\n"
"PO-Revision-Date: 2021-01-19 16:16-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-07 15:05-0400\n"
"POT-Creation-Date: 2024-10-16 10:12-0400\n"
"PO-Revision-Date: 2023-02-28 08:22-0500\n"
"Last-Translator: \n"
"Language: fr\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-07 15:05-0400\n"
"POT-Creation-Date: 2024-10-16 10:12-0400\n"
"PO-Revision-Date: 2023-01-26 13:29-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-07 15:05-0400\n"
"POT-Creation-Date: 2024-10-16 10:12-0400\n"
"PO-Revision-Date: 2023-02-28 08:10-0500\n"
"Last-Translator: \n"
"Language: fr\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-07 15:05-0400\n"
"POT-Creation-Date: 2024-10-16 10:11-0400\n"
"PO-Revision-Date: 2021-01-19 16:16-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-07 15:05-0400\n"
"POT-Creation-Date: 2024-10-16 10:11-0400\n"
"PO-Revision-Date: 2023-05-23 14:29-0400\n"
"Last-Translator: \n"
"Language: fr\n"
Expand Down
26 changes: 15 additions & 11 deletions teraserver/python/translations/en/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-07 15:05-0400\n"
"POT-Creation-Date: 2024-10-16 10:11-0400\n"
"PO-Revision-Date: 2021-01-25 13:01-0500\n"
"Last-Translator: \n"
"Language: en\n"
Expand Down Expand Up @@ -2147,45 +2147,49 @@ msgstr ""
msgid "Mirrored image"
msgstr ""

#: opentera/forms/TeraServiceConfigForm.py:54
#: opentera/forms/TeraServiceConfigForm.py:53
msgid "Blurred background"
msgstr ""

#: opentera/forms/TeraServiceConfigForm.py:55
msgid "URL"
msgstr ""

#: opentera/forms/TeraServiceConfigForm.py:58
#: opentera/forms/TeraServiceConfigForm.py:59
msgid "Pan-Tilt-Zoom Camera"
msgstr ""

#: opentera/forms/TeraServiceConfigForm.py:59
#: opentera/forms/TeraServiceConfigForm.py:60
msgid "Control Type"
msgstr ""

#: opentera/forms/TeraServiceConfigForm.py:60
#: opentera/forms/TeraServiceConfigForm.py:61
msgid "Vivotek"
msgstr ""

#: opentera/forms/TeraServiceConfigForm.py:65
#: opentera/forms/TeraServiceConfigForm.py:66
msgid "Network Address"
msgstr ""

#: opentera/forms/TeraServiceConfigForm.py:68
#: opentera/forms/TeraServiceConfigForm.py:69
msgid "Port"
msgstr ""

#: opentera/forms/TeraServiceConfigForm.py:71 opentera/forms/TeraUserForm.py:21
#: opentera/forms/TeraServiceConfigForm.py:72 opentera/forms/TeraUserForm.py:21
#: templates/login.html:125
msgid "Username"
msgstr ""

#: opentera/forms/TeraServiceConfigForm.py:74 opentera/forms/TeraUserForm.py:44
#: opentera/forms/TeraServiceConfigForm.py:75 opentera/forms/TeraUserForm.py:44
#: templates/login.html:131
msgid "Password"
msgstr ""

#: opentera/forms/TeraServiceConfigForm.py:78
#: opentera/forms/TeraServiceConfigForm.py:79
msgid "Microphone"
msgstr ""

#: opentera/forms/TeraServiceConfigForm.py:79
#: opentera/forms/TeraServiceConfigForm.py:80
msgid "Secondary Camera"
msgstr ""

Expand Down
28 changes: 16 additions & 12 deletions teraserver/python/translations/fr/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-07 15:05-0400\n"
"PO-Revision-Date: 2024-10-07 15:10-0400\n"
"POT-Creation-Date: 2024-10-16 10:11-0400\n"
"PO-Revision-Date: 2024-10-16 10:11-0400\n"
"Last-Translator: \n"
"Language-Team: fr <[email protected]>\n"
"Language: fr\n"
Expand Down Expand Up @@ -2235,45 +2235,49 @@ msgstr "Caméra"
msgid "Mirrored image"
msgstr "Image miroir"

#: opentera/forms/TeraServiceConfigForm.py:54
#: opentera/forms/TeraServiceConfigForm.py:53
msgid "Blurred background"
msgstr "Flouter l'arrière-plan"

#: opentera/forms/TeraServiceConfigForm.py:55
msgid "URL"
msgstr "Adresse web"

#: opentera/forms/TeraServiceConfigForm.py:58
#: opentera/forms/TeraServiceConfigForm.py:59
msgid "Pan-Tilt-Zoom Camera"
msgstr "Caméra Pan-Tilt-Zoom"

#: opentera/forms/TeraServiceConfigForm.py:59
#: opentera/forms/TeraServiceConfigForm.py:60
msgid "Control Type"
msgstr "Type de Contrôle"

#: opentera/forms/TeraServiceConfigForm.py:60
#: opentera/forms/TeraServiceConfigForm.py:61
msgid "Vivotek"
msgstr "Vivotek"

#: opentera/forms/TeraServiceConfigForm.py:65
#: opentera/forms/TeraServiceConfigForm.py:66
msgid "Network Address"
msgstr "Adresse Réseau"

#: opentera/forms/TeraServiceConfigForm.py:68
#: opentera/forms/TeraServiceConfigForm.py:69
msgid "Port"
msgstr "Port"

#: opentera/forms/TeraServiceConfigForm.py:71 opentera/forms/TeraUserForm.py:21
#: opentera/forms/TeraServiceConfigForm.py:72 opentera/forms/TeraUserForm.py:21
#: templates/login.html:125
msgid "Username"
msgstr "Code utilisateur"

#: opentera/forms/TeraServiceConfigForm.py:74 opentera/forms/TeraUserForm.py:44
#: opentera/forms/TeraServiceConfigForm.py:75 opentera/forms/TeraUserForm.py:44
#: templates/login.html:131
msgid "Password"
msgstr "Mot de passe"

#: opentera/forms/TeraServiceConfigForm.py:78
#: opentera/forms/TeraServiceConfigForm.py:79
msgid "Microphone"
msgstr "Microphone"

#: opentera/forms/TeraServiceConfigForm.py:79
#: opentera/forms/TeraServiceConfigForm.py:80
msgid "Secondary Camera"
msgstr "Caméra Secondaire"

Expand Down

0 comments on commit 93b2ff5

Please sign in to comment.