komplexLCG

THE STALKER EXPERIENCE @ MUFANT TURIN

Nov 4th, 2024
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.73 KB | Gaming | 0 0
  1. <!doctype html>
  2. <html>
  3.     <head>
  4.         <script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
  5.         <script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js"></script>
  6.         <script src="https://raw.githack.com/AR-js-org/studio-backend/master/src/modules/marker/tools/gesture-detector.js"></script>
  7.         <script src="https://raw.githack.com/AR-js-org/studio-backend/master/src/modules/marker/tools/gesture-handler.js"></script>
  8.         <script>
  9.             AFRAME.registerComponent('videohandler', {
  10.                 init: function () {
  11.                     var marker = this.el;
  12.                     this.vid = document.querySelector("#vid");
  13.  
  14.                     marker.addEventListener('markerFound', function () {
  15.                         this.toggle = true;
  16.                         this.vid.play();
  17.                     }.bind(this));
  18.  
  19.                     marker.addEventListener('markerLost', function () {
  20.                         this.toggle = false;
  21.                         this.vid.pause();
  22.                     }.bind(this));
  23.                 },
  24.             });
  25.         </script>
  26.     </head>
  27.  
  28.     <body style="margin: 0; overflow: hidden;">
  29.         <a-scene
  30.            vr-mode-ui="enabled: false"
  31.            loading-screen="enabled: false;"
  32.            arjs='sourceType: webcam; debugUIEnabled: false;'
  33.            id="scene"
  34.            embedded
  35.            gesture-detector
  36.        >
  37.             <a-assets>
  38.                 <video
  39.                    id="vid"
  40.                    src="assets/asset.mp4"
  41.                    preload="auto"
  42.                    response-type="arraybuffer"
  43.                    loop
  44.                    crossorigin
  45.                    webkit-playsinline
  46.                    autoplay                    
  47.                    playsinline
  48.                ></video>
  49.             </a-assets>
  50.  
  51.             <a-marker
  52.                type="pattern"
  53.                preset="custom"
  54.                url="assets/marker.patt"
  55.                videohandler
  56.                smooth="true"
  57.                smoothCount="10"
  58.                smoothTolerance="0.01"
  59.                smoothThreshold="5"
  60.                raycaster="objects: .clickable"
  61.                emitevents="true"
  62.                cursor="fuse: false; rayOrigin: mouse;"
  63.                id="markerA"
  64.            >
  65.                 <a-video
  66.                    src="#vid"
  67.                    scale="3 2 2"
  68.                    position="0 0.1 0"
  69.                    rotation="-90 0 0"
  70.                    class="clickable"
  71.                    gesture-handler
  72.                ></a-video>
  73.             </a-marker>
  74.  
  75.             <a-entity camera></a-entity>
  76.         </a-scene>
  77.     </body>
  78. </html>
Advertisement
Add Comment
Please, Sign In to add comment