瀏覽代碼

Load mp4 videos for better compatibility with Safari / iOS

customisations
alemart 1 年之前
父節點
當前提交
d3af586c20

二進制
demos/assets/my-video.mp4 查看文件


+ 4
- 1
demos/hello-aframe/index.html 查看文件

@@ -19,7 +19,10 @@
19 19
             </div>
20 20
         </div>
21 21
         <img id="my-reference-image" src="../assets/my-reference-image.webp" hidden>
22
-        <video id="my-video" src="../assets/my-video.webm" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
22
+        <video id="my-video" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
23
+            <source src="../assets/my-video.webm" type="video/webm" />
24
+            <source src="../assets/my-video.mp4" type="video/mp4" />
25
+        </video>
23 26
 
24 27
         <!-- This is a scene -->
25 28
         <a-scene ar-scene>

+ 4
- 1
demos/hello-three/index.html 查看文件

@@ -19,6 +19,9 @@
19 19
             </div>
20 20
         </div>
21 21
         <img id="my-reference-image" src="../assets/my-reference-image.webp" hidden>
22
-        <video id="my-video" src="../assets/my-video.webm" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
22
+        <video id="my-video" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
23
+            <source src="../assets/my-video.webm" type="video/webm" />
24
+            <source src="../assets/my-video.mp4" type="video/mp4" />
25
+        </video>
23 26
     </body>
24 27
 </html>

+ 4
- 1
demos/hello-webgl/index.html 查看文件

@@ -18,6 +18,9 @@
18 18
         <img id="it-works" src="../assets/it-works.png" hidden>
19 19
         <img id="bird" src="../assets/bird.png" hidden>
20 20
         <img id="my-reference-image" src="../assets/my-reference-image.webp" hidden>
21
-        <video id="my-video" src="../assets/my-video.webm" hidden muted loop autoplay playsinline oncanplay="this.muted=true;this.play()"></video>
21
+        <video id="my-video" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
22
+            <source src="../assets/my-video.webm" type="video/webm" />
23
+            <source src="../assets/my-video.mp4" type="video/mp4" />
24
+        </video>
22 25
     </body>
23 26
 </html>

+ 4
- 1
demos/hello-world/index.html 查看文件

@@ -16,6 +16,9 @@
16 16
             </div>
17 17
         </div>
18 18
         <img id="my-reference-image" src="../assets/my-reference-image.webp" hidden>
19
-        <video id="my-video" src="../assets/my-video.webm" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
19
+        <video id="my-video" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
20
+            <source src="../assets/my-video.webm" type="video/webm" />
21
+            <source src="../assets/my-video.mp4" type="video/mp4" />
22
+        </video>
20 23
     </body>
21 24
 </html>

+ 4
- 1
demos/touch-interaction/index.html 查看文件

@@ -20,6 +20,9 @@
20 20
             </div>
21 21
         </div>
22 22
         <img id="my-reference-image" src="../assets/my-reference-image.webp" hidden>
23
-        <video id="my-video" src="../assets/my-video.webm" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
23
+        <video id="my-video" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
24
+            <source src="../assets/my-video.webm" type="video/webm" />
25
+            <source src="../assets/my-video.mp4" type="video/mp4" />
26
+        </video>
24 27
     </body>
25 28
 </html>

二進制
docs/assets/my-video.mp4 查看文件


+ 8
- 2
docs/getting-started/activate-your-webcam.md 查看文件

@@ -60,7 +60,10 @@ Let's also comment (or remove) the `<video>` tag from the HTML file - we no long
60 60
         <div id="ar-viewport"></div>
61 61
         <img id="my-reference-image" src="my-reference-image.webp" hidden>
62 62
         <!--
63
-        <video id="my-video" src="my-video.webm" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
63
+        <video id="my-video" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
64
+            <source src="my-video.webm" type="video/webm" />
65
+            <source src="my-video.mp4" type="video/mp4" />
66
+        </video>
64 67
         -->
65 68
     </body>
66 69
 </html>
@@ -139,7 +142,10 @@ In order to display that scan gimmick, we need to create a HUD. A HUD is an over
139 142
         </div>
140 143
         <img id="my-reference-image" src="my-reference-image.webp" hidden>
141 144
         <!--
142
-        <video id="my-video" src="my-video.webm" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
145
+        <video id="my-video" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
146
+            <source src="my-video.webm" type="video/webm" />
147
+            <source src="my-video.mp4" type="video/mp4" />
148
+        </video>
143 149
         -->
144 150
     </body>
145 151
 </html>

+ 14
- 7
docs/getting-started/create-the-augmented-scene.md 查看文件

@@ -30,23 +30,27 @@ Once you pick a 3D rendering technology, you need to integrate it with MARTINS.j
30 30
 
31 31
 Writing a glue code is a task of moderate complexity. It requires dealing with matrices, with performance issues, and with some idiosyncrasies of the 3D rendering technologies in order to make sure it all works as intended. It is advisable to have specialized knowledge of computer graphics programming in order to write a glue code that works correctly.
32 32
 
33
-I provide easy-to-use glue codes that work with different 3D rendering technologies in my demos, so that you don't need to deal with the complexity. Those glue codes are JavaScript (.js) files. You just need to add a glue code to your web page (e.g., via a `<script>` tag) and then the integration will be done for you. It's really that simple! Also, my glue codes may be used in both free and non-free projects.
33
+I provide easy-to-use glue codes that work with different 3D rendering technologies in my demos, so that you don't need to deal with the complexity. Those glue codes are JavaScript (.js) files. You just need to add a glue code to your web page (e.g., via a `<script>` tag) and then the integration will be done for you. It's really that simple!
34 34
 
35
-[:octocat: Get the glue codes on GitHub](https://github.com/alemart/martins-js/tree/master/dist){ .md-button ._blank }
36
-
37
-[Get the glue codes in my demos](../gallery.md){ .md-button ._blank }
35
+[Find the glue codes in my demos](../gallery.md){ .md-button ._blank }
38 36
 
39 37
 ## Create the virtual scene
40 38
 
41 39
 Once you plug in the glue code, you'll be using the 3D rendering technology of your choice to create the virtual scene. The physical scene will be automatically augmented with the virtual scene, thus creating the augmented scene.
42 40
 
43 41
 <figure markdown>
44
-<video src="../../img/demo-cool2.webm" poster="../../img/demo-cool2.webp" style="width:600px" controls muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
42
+<video poster="../../img/demo-cool2.webp" style="width:600px" controls muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
43
+    <source src="../../img/demo-cool2.webm" type="video/webm" />
44
+    <source src="../../img/demo-cool2.mp4" type="video/mp4" />
45
+</video>
45 46
 <figcaption markdown>An augmented scene with a [3D model](../assets/my-3d-model.glb "A public domain 3D model from Kenney, converted to glTF format") from [Kenney](https://www.kenney.nl){ ._blank }</figcaption>
46 47
 </figure>
47 48
 
48 49
 <figure markdown>
49
-<video src="../../img/demo-cool.webm" poster="../../img/demo-cool.webp" style="width:600px" controls muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
50
+<video poster="../../img/demo-cool.webp" style="width:600px" controls muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
51
+    <source src="../../img/demo-cool.webm" type="video/webm" />
52
+    <source src="../../img/demo-cool.mp4" type="video/mp4" />
53
+</video>
50 54
 <figcaption markdown>A similar augmented scene viewed from a different perspective</figcaption>
51 55
 </figure>
52 56
 
@@ -76,7 +80,10 @@ A-Frame is easy for beginners and pleasing for experts. A simple scene is declar
76 80
     <body>
77 81
         <div id="ar-viewport"></div>
78 82
         <img id="my-reference-image" src="my-reference-image.webp" hidden>
79
-        <video id="my-video" src="my-video.webm" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
83
+        <video id="my-video" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
84
+            <source src="my-video.webm" type="video/webm" />
85
+            <source src="my-video.mp4" type="video/mp4" />
86
+        </video>
80 87
 
81 88
         <!-- This is a scene -->
82 89
         <a-scene ar-scene>

+ 8
- 2
docs/getting-started/introduction.md 查看文件

@@ -5,7 +5,10 @@ Augmented Reality (AR) has applications in many fields, including: games, market
5 5
 Traditionally, users were required to download (sometimes large) apps to experience AR. That was an obstacle for adoption. What if we dropped the need for apps and just required a web browser instead? Users already have web browsers! That's where WebAR comes in.
6 6
 
7 7
 <figure markdown>
8
-<video src="../../img/demo-cool.webm" poster="../../img/demo-cool.webp" style="width:600px" controls muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
8
+<video poster="../../img/demo-cool.webp" style="width:600px" controls muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
9
+    <source src="../../img/demo-cool.webm" type="video/webm" />
10
+    <source src="../../img/demo-cool.mp4" type="video/mp4" />
11
+</video>
9 12
 <figcaption>A WebAR demo created with MARTINS.js</figcaption>
10 13
 </figure>
11 14
 
@@ -16,7 +19,10 @@ We will create together an Augmented Reality experience that runs in web browser
16 19
 No matter if you are a beginner, an expert, or somewhere in-between, set yourself at ease: this step-by-step guide can be followed by you.
17 20
 
18 21
 <figure markdown>
19
-<video src="../../img/demo-cool3.webm" poster="../../img/demo-cool3.webp" style="width:600px" controls muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
22
+<video poster="../../img/demo-cool3.webp" style="width:600px" controls muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
23
+    <source src="../../img/demo-cool3.webm" type="video/webm" />
24
+    <source src="../../img/demo-cool3.mp4" type="video/mp4" />
25
+</video>
20 26
 <figcaption>Augmented Reality based on Image Tracking</figcaption>
21 27
 </figure>
22 28
 

+ 4
- 1
docs/getting-started/set-up-the-session.md 查看文件

@@ -20,7 +20,10 @@ We begin by creating the viewport. Remember that the viewport is the area in whi
20 20
     <body>
21 21
         <div id="ar-viewport"></div>
22 22
         <img id="my-reference-image" src="my-reference-image.webp" hidden>
23
-        <video id="my-video" src="my-video.webm" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
23
+        <video id="my-video" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
24
+            <source src="my-video.webm" type="video/webm" />
25
+            <source src="my-video.mp4" type="video/mp4" />
26
+        </video>
24 27
     </body>
25 28
 </html>
26 29
 ```

+ 15
- 4
docs/getting-started/set-up-the-tracker.md 查看文件

@@ -62,10 +62,13 @@ Once you see that the image is being properly loaded, there is no need to keep i
62 62
 
63 63
 ## Add a test video
64 64
 
65
-We're going to be tracking that reference image in a test video. Please save the following video as [my-video.webm](../assets/my-video.webm){ ._blank } in `ar-demo/`. Later on I'll tell you how to use your webcam instead.
65
+We're going to be tracking that reference image in a test video. Please save the following video as [my-video.webm](../assets/my-video.webm){ ._blank } and [my-video.mp4](../assets/my-video.mp4){ ._blank } in `ar-demo/`. Later on I'll tell you how to use your webcam instead.
66 66
 
67 67
 <figure markdown>
68
-<video src="../../assets/my-video.webm" style="width:600px" controls muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
68
+<video style="width:600px" controls muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
69
+    <source src="../../assets/my-video.webm" type="video/webm" />
70
+    <source src="../../assets/my-video.mp4" type="video/mp4" />
71
+</video>
69 72
 </figure>
70 73
 
71 74
 This is the expected directory structure at this point:
@@ -74,6 +77,7 @@ This is the expected directory structure at this point:
74 77
     ├── index.html
75 78
     ├── martins.js
76 79
     ├── my-reference-image.webp
80
+    ├── my-video.mp4
77 81
     └── my-video.webm
78 82
 
79 83
 Let's include the test video in our page. Add a `<video>` tag as follows:
@@ -90,7 +94,10 @@ Let's include the test video in our page. Add a `<video>` tag as follows:
90 94
     </head>
91 95
     <body>
92 96
         <img id="my-reference-image" src="my-reference-image.webp" hidden>
93
-        <video id="my-video" src="my-video.webm" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
97
+        <video id="my-video" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
98
+            <source src="my-video.webm" type="video/webm" />
99
+            <source src="my-video.mp4" type="video/mp4" />
100
+        </video>
94 101
     </body>
95 102
 </html>
96 103
 ```
@@ -116,7 +123,10 @@ We'll be writing a little bit of JavaScript code now. In order to keep our code
116 123
     </head>
117 124
     <body>
118 125
         <img id="my-reference-image" src="my-reference-image.webp" hidden>
119
-        <video id="my-video" src="my-video.webm" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
126
+        <video id="my-video" hidden muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
127
+            <source src="my-video.webm" type="video/webm" />
128
+            <source src="my-video.mp4" type="video/mp4" />
129
+        </video>
120 130
     </body>
121 131
 </html>
122 132
 ```
@@ -153,6 +163,7 @@ Before moving on, make sure that you have the following directory structure at t
153 163
     ├── index.html
154 164
     ├── martins.js
155 165
     ├── my-reference-image.webp
166
+    ├── my-video.mp4
156 167
     └── my-video.webm
157 168
 
158 169
 ## Link the image to the tracker

二進制
docs/img/demo-cool.mp4 查看文件


二進制
docs/img/demo-cool2.mp4 查看文件


二進制
docs/img/demo-cool3.mp4 查看文件


二進制
docs/img/splash.mp4 查看文件


+ 4
- 1
docs_overrides/home.html 查看文件

@@ -115,7 +115,10 @@
115 115
             <a href="{{ './demo/instructions' | url }}" class="md-button">Try a demo</a>
116 116
         </div>
117 117
         <div class="splash-image">
118
-            <video src="{{ './img/splash.webm' | url }}" poster="{{ './img/splash.webp' | url }}" muted loop playsinline autoplay oncanplay="this.muted=true;this.play()"></video>
118
+            <video poster="{{ './img/splash.webp' | url }}" muted loop playsinline autoplay oncanplay="this.muted=true;this.play()">
119
+                <source src="{{ './img/splash.webm' | url }}" type="video/webm" />
120
+                <source src="{{ './img/splash.mp4' | url }}" type="video/mp4" />
121
+            </video>
119 122
         </div>
120 123
     </div>
121 124
 </section>

Loading…
取消
儲存