show error message if no camera is present
This commit is contained in:
@@ -138,6 +138,14 @@ export default function Scanner({ onScan }: ScannerProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full max-w-2xl mx-auto">
|
<div className="w-full max-w-2xl mx-auto">
|
||||||
|
{hasCamera === false ? (
|
||||||
|
<div className="p-4 text-center">
|
||||||
|
<p className="text-red-600 text-lg">
|
||||||
|
Denne nettsiden krever tilgang til et kamera.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
<div className={getVideoContainerClass()}>
|
<div className={getVideoContainerClass()}>
|
||||||
<video
|
<video
|
||||||
ref={videoRef}
|
ref={videoRef}
|
||||||
@@ -270,6 +278,9 @@ export default function Scanner({ onScan }: ScannerProps) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
<style jsx>{`
|
<style jsx>{`
|
||||||
/* Responsive video container for mobile portrait */
|
/* Responsive video container for mobile portrait */
|
||||||
@media (max-width: 768px) and (orientation: portrait) {
|
@media (max-width: 768px) and (orientation: portrait) {
|
||||||
|
Reference in New Issue
Block a user