File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 < script defer src ="face-api.min.js "> </ script >
99 < script defer src ="script.js "> </ script >
1010 < style >
11- body {
12- margin : 0 ;
13- padding : 0 ;
14- width : 100vw ;
15- height : 100vh ;
16- display : flex;
17- justify-content : center;
18- align-items : center;
19- }
20-
2111 canvas {
2212 position : absolute;
2313 }
2414
15+ # container {
16+ position : relative;
17+ display : flex;
18+ justify-content : center;
19+ }
20+
2521 # video {
2622 display : none;
2723 }
24+
25+ # loading {
26+ text-align : center;
27+ }
2828 </ style >
2929 </ head >
3030 < body >
31- < video id ="video " width ="720 " height ="560 " autoplay muted > </ video >
32- < p id ="loading "> Wating for camera to load</ p >
31+ < div id ="container ">
32+ < video id ="video " width ="300 " height ="300 " autoplay muted > </ video >
33+ < p id ="loading "> Wating for camera to load</ p >
34+ </ div >
3335 </ body >
3436</ html >
Original file line number Diff line number Diff line change 1+ const container = document . getElementById ( "container" ) ;
12const video = document . getElementById ( "video" ) ;
23const loader = document . getElementById ( "loading" ) ;
34
@@ -25,7 +26,7 @@ function startVideo() {
2526
2627video . addEventListener ( "play" , ( ) => {
2728 const canvas = faceapi . createCanvasFromMedia ( video ) ;
28- document . body . append ( canvas ) ;
29+ container . appendChild ( canvas ) ;
2930 const displaySize = { width : video . width , height : video . height } ;
3031 faceapi . matchDimensions ( canvas , displaySize ) ;
3132 setInterval ( async ( ) => {
You can’t perform that action at this time.
0 commit comments