@@ -136,6 +136,8 @@ The basic operation goes like this:
1361365 . Add a ` 'getMarker' ` event listener
1371376 . Call ` ARController.process(img) `
138138
139+ ### Basic example with an image source and a pattern marker ( hiro )
140+
139141``` js
140142< script src= " ../build/artoolkit.min.js" >< / script>
141143< script>
@@ -169,6 +171,45 @@ The basic operation goes like this:
169171< / script>
170172```
171173
174+ ### Basic example with a worker and a NFT marker
175+
176+ ``` js
177+ < div id= " container" >
178+ < video id= " video" >< / video>
179+ < canvas style= " position: absolute; left:0; top:0" id= " canvas_draw" >< / canvas>
180+ < / div>
181+ // main worker create the web worker see in the examples/nft_improved_worker for details
182+ < script src= " main_worker.js" >< / script>
183+ < script>
184+ var container = document .getElementById (' container' );
185+ var video = document .getElementById (' video' );
186+ var canvas_draw = document .getElementById (' canvas_draw' );
187+
188+ if (navigator .mediaDevices && navigator .mediaDevices .getUserMedia ) {
189+ var hint = {};
190+ if (isMobile ()) {
191+ hint = {
192+ facingMode: {" ideal" : " environment" },
193+ audio: false ,
194+ video: {
195+ width: {min: 240 , max: 240 },
196+ height: {min: 360 , max: 360 },
197+ },
198+ };
199+ }
200+
201+ navigator .mediaDevices .getUserMedia ({video: hint}).then (function (stream ) {
202+ video .srcObject = stream;
203+ video .play ();
204+ video .addEventListener (" loadedmetadata" , function () {
205+ start (container, markers[" pinball" ], video, video .videoWidth , video .videoHeight , canvas_draw, function () { statsMain .update () }, function () { statsWorker .update ()) };
206+ });
207+ });
208+ }
209+ < / script>
210+ ` ` `
211+
212+
172213## Constants
173214
174215*prepend all these constants with ` Module.` or ` artoolkit .CONSTANTS ` to access them*
0 commit comments