Download index.html from Mkdm1/ar: direct link, hf CLI and curl.
- Browser
- Download file 14.4 kB
-
https://huggingface.co/spaces/Mkdm1/ar/resolve/main/index.html
- Command line
-
hf download hf://spaces/Mkdm1/ar/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Mkdm1/ar/resolve/main/index.html
14.4 kB
| <html lang="ar" dir="rtl"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>تجربة الواقع المعزز بالفيديو | AR.js</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script> | |
| <script src="https://cdn.rawgit.com/jeromeetienne/ar.js/2.1.8/aframe/build/aframe-ar.min.js"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| .arjs-loader { | |
| height: 100%; | |
| width: 100%; | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| background-color: rgba(0, 0, 0, 0.8); | |
| z-index: 9999; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| flex-direction: column; | |
| color: white; | |
| } | |
| .arjs-loader div { | |
| text-align: center; | |
| font-size: 1.25em; | |
| margin-top: 1em; | |
| } | |
| .controls-panel { | |
| position: absolute; | |
| bottom: 20px; | |
| left: 50%; | |
| transform: translateX(-50%); | |
| z-index: 100; | |
| background: rgba(0,0,0,0.7); | |
| border-radius: 20px; | |
| padding: 10px; | |
| backdrop-filter: blur(5px); | |
| } | |
| .info-panel { | |
| position: absolute; | |
| top: 20px; | |
| right: 20px; | |
| z-index: 100; | |
| background: rgba(0,0,0,0.7); | |
| border-radius: 15px; | |
| padding: 15px; | |
| color: white; | |
| max-width: 300px; | |
| backdrop-filter: blur(5px); | |
| } | |
| @media (max-width: 768px) { | |
| .info-panel { | |
| max-width: 200px; | |
| font-size: 0.8rem; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-900 text-white font-sans"> | |
| <!-- Loading Screen --> | |
| <div class="arjs-loader"> | |
| <div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-blue-500 mb-4"></div> | |
| <div>جاري تحميل تجربة الواقع المعزز...</div> | |
| <div class="text-sm mt-2">يمكنك الآن عرض المحتوى في مساحة العالم الحقيقي</div> | |
| </div> | |
| <!-- AR Scene --> | |
| <a-scene embedded arjs='sourceType: webcam; detectionMode: mono;' vr-mode-ui="enabled: false" loading-screen="enabled: false;"> | |
| <!-- Video Content --> | |
| <a-entity id="content-entity" position="0 0 -2"> | |
| <a-video | |
| id="ar-video" | |
| src="https://www.w3schools.com/html/mov_bbb.mp4" | |
| width="1.5" | |
| height="1" | |
| position="0 0 0" | |
| rotation="0 0 0" | |
| autoplay="false" | |
| loop="true"> | |
| </a-video> | |
| </a-entity> | |
| <!-- Camera --> | |
| <a-entity camera></a-entity> | |
| </a-scene> | |
| <!-- Info Panel --> | |
| <div class="info-panel hidden md:block"> | |
| <h2 class="text-xl font-bold mb-2 text-blue-400">تعليمات الاستخدام</h2> | |
| <ul class="list-disc list-inside space-y-2"> | |
| <li>وجه الكاميرا نحو المساحة التي تريد عرض المحتوى فيها</li> | |
| <li>استخدم عناصر التحكم للتحكم بالفيديو</li> | |
| <li>يمكنك تحريك جهازك لتغيير زاوية العرض</li> | |
| <li>استخدم الاستوديو لتغيير المحتوى المعروض</li> | |
| </ul> | |
| <div class="mt-3 pt-3 border-t border-gray-600"> | |
| <p class="text-sm">تم التطوير باستخدام AR.js و A-Frame</p> | |
| </div> | |
| </div> | |
| <!-- Controls Panel --> | |
| <div class="controls-panel flex items-center space-x-4 space-x-reverse"> | |
| <button id="studio-btn" class="bg-purple-600 hover:bg-purple-700 text-white p-3 rounded-full"> | |
| <i class="fas fa-cog"></i> | |
| </button> | |
| <button id="play-btn" class="bg-blue-600 hover:bg-blue-700 text-white p-3 rounded-full"> | |
| <i class="fas fa-play"></i> | |
| </button> | |
| <button id="pause-btn" class="bg-yellow-600 hover:bg-yellow-700 text-white p-3 rounded-full"> | |
| <i class="fas fa-pause"></i> | |
| </button> | |
| <button id="volume-up" class="bg-green-600 hover:bg-green-700 text-white p-3 rounded-full"> | |
| <i class="fas fa-volume-up"></i> | |
| </button> | |
| <button id="volume-off" class="bg-red-600 hover:bg-red-700 text-white p-3 rounded-full"> | |
| <i class="fas fa-volume-off"></i> | |
| </button> | |
| </div> | |
| <!-- AR Studio --> | |
| <div id="ar-studio" class="fixed inset-0 bg-black bg-opacity-90 z-50 hidden flex flex-col items-center justify-center p-4"> | |
| <div class="bg-gray-800 rounded-lg p-6 w-full max-w-md"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h2 class="text-xl font-bold text-white">استوديو AR</h2> | |
| <button id="close-studio" class="text-gray-400 hover:text-white"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div class="space-y-4"> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-300 mb-1">رابط الفيديو</label> | |
| <input type="text" id="video-url" class="w-full bg-gray-700 text-white rounded p-2 mb-2" | |
| placeholder="أدخل رابط الفيديو" value="https://www.w3schools.com/html/mov_bbb.mp4"> | |
| <label class="block text-sm font-medium text-gray-300 mb-1">رابط الصورة</label> | |
| <input type="text" id="image-url" class="w-full bg-gray-700 text-white rounded p-2" | |
| placeholder="أدخل رابط الصورة"> | |
| </div> | |
| <div class="pt-2 border-t border-gray-700"> | |
| <div class="flex space-x-2 space-x-reverse"> | |
| <button id="set-video" class="flex-1 bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded"> | |
| <i class="fas fa-video mr-2"></i> تعيين فيديو | |
| </button> | |
| <button id="set-image" class="flex-1 bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded"> | |
| <i class="fas fa-image mr-2"></i> تعيين صورة | |
| </button> | |
| </div> | |
| </div> | |
| <div class="flex space-x-2 space-x-reverse"> | |
| <button id="apply-video" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded"> | |
| تطبيق الفيديو | |
| </button> | |
| <button id="test-video" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded"> | |
| اختبار | |
| </button> | |
| <button id="download-marker" class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded"> | |
| <i class="fas fa-download mr-2"></i> تحميل الماركر | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', () => { | |
| const scene = document.querySelector('a-scene'); | |
| const loader = document.querySelector('.arjs-loader'); | |
| const video = document.querySelector('#ar-video'); | |
| const playBtn = document.querySelector('#play-btn'); | |
| const pauseBtn = document.querySelector('#pause-btn'); | |
| const volumeUp = document.querySelector('#volume-up'); | |
| const volumeOff = document.querySelector('#volume-off'); | |
| const markerDetected = document.querySelector('#marker-detected'); | |
| const marker = document.querySelector('#video-marker'); | |
| // Hide loader when scene is loaded | |
| scene.addEventListener('loaded', () => { | |
| setTimeout(() => { | |
| loader.style.display = 'none'; | |
| }, 1500); | |
| }); | |
| // Video controls | |
| playBtn.addEventListener('click', () => { | |
| video.components.material.material.map.image.play(); | |
| playBtn.classList.add('hidden'); | |
| pauseBtn.classList.remove('hidden'); | |
| }); | |
| pauseBtn.addEventListener('click', () => { | |
| video.components.material.material.map.image.pause(); | |
| pauseBtn.classList.add('hidden'); | |
| playBtn.classList.remove('hidden'); | |
| }); | |
| volumeUp.addEventListener('click', () => { | |
| video.setAttribute('sound', 'volume', 1); | |
| volumeUp.classList.add('hidden'); | |
| volumeOff.classList.remove('hidden'); | |
| }); | |
| volumeOff.addEventListener('click', () => { | |
| video.setAttribute('sound', 'volume', 0); | |
| volumeOff.classList.add('hidden'); | |
| volumeUp.classList.remove('hidden'); | |
| }); | |
| // Initially hide pause button (video starts paused) | |
| pauseBtn.classList.add('hidden'); | |
| volumeOff.classList.add('hidden'); | |
| // Add sound component to video | |
| video.setAttribute('sound', 'src', '#video-src; autoplay: false; volume: 1'); | |
| // Handle mobile orientation | |
| window.addEventListener('orientationchange', () => { | |
| window.location.reload(); | |
| }); | |
| // Studio controls | |
| const studioBtn = document.querySelector('#studio-btn'); | |
| const studio = document.querySelector('#ar-studio'); | |
| const closeStudio = document.querySelector('#close-studio'); | |
| const videoUrl = document.querySelector('#video-url'); | |
| const applyVideo = document.querySelector('#apply-video'); | |
| const testVideo = document.querySelector('#test-video'); | |
| studioBtn.addEventListener('click', () => { | |
| studio.classList.remove('hidden'); | |
| }); | |
| closeStudio.addEventListener('click', () => { | |
| studio.classList.add('hidden'); | |
| }); | |
| applyVideo.addEventListener('click', () => { | |
| video.setAttribute('src', videoUrl.value); | |
| studio.classList.add('hidden'); | |
| }); | |
| testVideo.addEventListener('click', () => { | |
| const testWindow = window.open(videoUrl.value, '_blank'); | |
| setTimeout(() => { | |
| testWindow.close(); | |
| }, 3000); | |
| }); | |
| // Handle content switching | |
| const contentEntity = document.querySelector('#content-entity'); | |
| const imageUrl = document.querySelector('#image-url'); | |
| const setVideo = document.querySelector('#set-video'); | |
| const setImage = document.querySelector('#set-image'); | |
| setVideo.addEventListener('click', () => { | |
| const url = videoUrl.value; | |
| if (!url) return; | |
| // Clear existing content | |
| contentEntity.innerHTML = ''; | |
| // Add video element | |
| const videoEl = document.createElement('a-video'); | |
| videoEl.setAttribute('id', 'ar-video'); | |
| videoEl.setAttribute('src', url); | |
| videoEl.setAttribute('width', '1.5'); | |
| videoEl.setAttribute('height', '1'); | |
| videoEl.setAttribute('position', '0 0 0'); | |
| videoEl.setAttribute('rotation', '0 0 0'); | |
| videoEl.setAttribute('autoplay', 'false'); | |
| videoEl.setAttribute('loop', 'true'); | |
| contentEntity.appendChild(videoEl); | |
| studio.classList.add('hidden'); | |
| }); | |
| // Marker download | |
| const downloadMarker = document.querySelector('#download-marker'); | |
| downloadMarker.addEventListener('click', () => { | |
| const link = document.createElement('a'); | |
| link.href = 'https://raw.githubusercontent.com/AR-js-org/AR.js/master/data/images/hiro.png'; | |
| link.download = 'ar-marker.png'; | |
| document.body.appendChild(link); | |
| link.click(); | |
| document.body.removeChild(link); | |
| }); | |
| setImage.addEventListener('click', () => { | |
| const url = imageUrl.value; | |
| if (!url) return; | |
| // Clear existing content | |
| contentEntity.innerHTML = ''; | |
| // Add image element | |
| const imageEl = document.createElement('a-image'); | |
| imageEl.setAttribute('id', 'ar-image'); | |
| imageEl.setAttribute('src', url); | |
| imageEl.setAttribute('width', '1.5'); | |
| imageEl.setAttribute('height', '1'); | |
| imageEl.setAttribute('position', '0 0 0'); | |
| imageEl.setAttribute('rotation', '0 0 0'); | |
| contentEntity.appendChild(imageEl); | |
| studio.classList.add('hidden'); | |
| }); | |
| }); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Mkdm1/ar" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |