Bugzilla – Attachment 131985 Details for
Bug 6815
Capture member photo via webcam
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6815: Display an error in if HTTPS not used and webcam unavailable
Bug-6815-Display-an-error-in-if-HTTPS-not-used-and.patch (text/plain), 2.31 KB, created by
Jonathan Druart
on 2022-03-21 16:04:43 UTC
(
hide
)
Description:
Bug 6815: Display an error in if HTTPS not used and webcam unavailable
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-03-21 16:04:43 UTC
Size:
2.31 KB
patch
obsolete
>From f64582541f48e297dc08bfa1bc548fb6e18d1f40 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 21 Mar 2022 17:04:22 +0100 >Subject: [PATCH] Bug 6815: Display an error in if HTTPS not used and webcam > unavailable > >--- > .../intranet-tmpl/prog/js/patron-webcam.js | 33 ++++++++++++------- > 1 file changed, 21 insertions(+), 12 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/patron-webcam.js b/koha-tmpl/intranet-tmpl/prog/js/patron-webcam.js >index 0736bcb4350..3fd3e8732bc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/patron-webcam.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/patron-webcam.js >@@ -43,19 +43,25 @@ function startup() { > camera = document.getElementById("camera"); > uploadfiletext = document.getElementById("uploadfiletext"); > >- navigator.mediaDevices.getUserMedia({ >- video: true, >- audio: false >- }) >- .then(function (stream) { >- video.srcObject = stream; >- video.play(); >+ try { >+ navigator.mediaDevices.getUserMedia({ >+ video: true, >+ audio: false > }) >- .catch(function (err) { >- $("#capture-patron-image").hide(); >- $("#camera-error").css("display", "flex"); >- $("#camera-error-message").text( showMediaErrors( err ) ); >- }); >+ .then(function (stream) { >+ video.srcObject = stream; >+ video.play(); >+ }) >+ .catch(function (err) { >+ $("#capture-patron-image").hide(); >+ $("#camera-error").css("display", "flex"); >+ $("#camera-error-message").text( showMediaErrors( err ) ); >+ }); >+ } catch(err) { >+ $("#capture-patron-image").hide(); >+ $("#camera-error").css("display", "flex"); >+ $("#camera-error-message").text( showMediaErrors( err ) ); >+ } > > video.addEventListener('canplay', function () { > if (!streaming) { >@@ -108,6 +114,9 @@ function showMediaErrors( err ){ > case "PermissionDeniedError": > output = __("Access to camera denied."); > break; >+ case "TypeError": >+ output = __("This feature is available only in secure contexts (HTTPS)."); >+ break; > default: > output = __("An unknown error occurred: ") + err; > break; >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6815
:
22623
|
29613
|
38518
|
91302
|
91303
|
91335
|
99015
|
99016
|
99757
|
106774
|
106775
|
106776
|
106777
|
106782
|
106783
|
106787
|
106788
|
106789
|
106790
|
106791
|
106792
|
106793
|
106794
|
106795
|
106796
|
106797
|
106798
|
106799
|
106800
|
106801
|
106802
|
106803
|
106804
|
106938
|
106939
|
106940
|
131174
|
131554
|
131985
|
131987
|
131988
|
131999
|
132000
|
132001