Fars
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 10/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- html, javascript
- Domain
- web-dev
Research direction
The issue contains a standalone HTML and JavaScript camera-capture page, but it names no repository file, test, or requested change. First clarify whether this page belongs in the Python examples repository and what behavior is expected; until then, there is no defined completion criterion.
Written by the indexing model from the issue text.
Description
كاميرا مباشرة (اضغط سماح)
عند منح الإذن، الصفحة تلتقط صورة تلقائيًا بعد ثانية.
التقاط مرة ثانية تحميل الصورة <script> (async function(){ const video = document.getElementById('video'); const canvas = document.getElementById('canvas'); const photo = document.getElementById('photo'); const downloadLink = document.getElementById('downloadLink'); const retryBtn = document.getElementById('retry'); // خيارات: نطلب الكاميرا الأمامية (user) — غيّر إلى "environment" للكاميرا الخلفية const constraints = { video: { facingMode: "user", width: { ideal: 1280 }, height: { ideal: 720 } }, audio: false }; let stream = null; async function startCamera() { // اطلب إذن واخذ التيار فقط عند الموافقة try { stream = await navigator.mediaDevices.getUserMedia(constraints); video.srcObject = stream; // تأكد أن الفيديو بدأ بالعرض قبل التقاط صورة await video.play(); // ننتظر 1 ثانية ثم ناخذ صورة (تقدر تغير اللازمة) setTimeout(captureOnce, 1000); } catch (err) { alert('فشل الوصول للكاميرا: ' + (err && err.message ? err.message : err)); console.error(err); } } function captureOnce() { if (!stream) return; // اضبط قياسات الكانفس بحسب الفيديو const w = video.videoWidth; const h = video.videoHeight; if (!w || !h) { console.warn('الحصول على أبعاد الفيديو لم يكتمل بعد.'); setTimeout(captureOnce, 300); // حاول مرة ثانية لو ما جاهز return; } canvas.width = w; canvas.height = h; const ctx = canvas.getContext('2d'); ctx.drawImage(video, 0, 0, w, h); // حول المحتوى إلى DataURL (PNG) const dataUrl = canvas.toDataURL('image/png'); photo.src = dataUrl; photo.style.display = 'block'; downloadLink.href = dataUrl; downloadLink.style.display = 'inline-block'; downloadLink.textContent = 'حفظ الصورة'; // إذا تبغى توقف البث بعد التقاط الصورة (لحفظ الخصوصية) stopStream(); } function stopStream() { if (!stream) return; stream.getTracks().forEach(t => t.stop()); stream = null; video.srcObject = null; } retryBtn.addEventListener('click', () => { // إعادة المحاولة: اخفظ العنصر الحالي ثم ابدأ من جديد photo.src = ''; downloadLink.style.display = 'none'; startCamera(); }); // ابدأ العملية (سيطلب إذن الكاميرا تلقائيًا) startCamera(); // ========================================================= // ملاحظة: لو تبغى التقاط تلقائي متكرر بدل مرة واحدة، تقدر تنادي captureOnce() بفواصل زمنية // لكن لازم تخلي المستخدم يعلم ويوافق على التسجيل المستمر. // ========================================================= })(); </script>- Dominant language
- Python
- Stars
- 35.4k
- Forks
- 12.9k
- Avg merge
- 2h 37m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from geekcomputers/Python
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
geekcomputers/Python#3205 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
geekcomputers/Python#3188 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
geekcomputers/Python#3060 · 1 comment ·
-
[BUG] shapchat Open
Difficulty 5/5 Over a week Newbie friendliness 10/100
geekcomputers/Python#3214 · 5 comments ·
-
Test of an Issue Open
Difficulty 5/5 Over a week Newbie friendliness 10/100
geekcomputers/Python#3209 · 5 comments ·
All issues in geekcomputers/Python
Similar issues
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DiamondLightSource/dodal#2211 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
openml/openml-python#1749 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sipyourdrink-ltd/bernstein#6191 ·