Tina Tarighian commited on
Commit
bba5c78
·
1 Parent(s): 57cdd61

mobile scroll

Browse files
components/CameraSetup.js CHANGED
@@ -141,6 +141,22 @@ const CameraSetup = ({
141
 
142
  try {
143
  await videoRef.current.play();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  } catch (playError) {
145
  console.log("Play interrupted during camera switch:", playError);
146
  // Don't treat play interruptions as fatal errors
 
141
 
142
  try {
143
  await videoRef.current.play();
144
+
145
+ // Explicitly handle metadata loading after camera switch
146
+ videoRef.current.onloadedmetadata = () => {
147
+ if (!isMounted.current) return;
148
+
149
+ const videoWidth = videoRef.current.videoWidth;
150
+ const videoHeight = videoRef.current.videoHeight;
151
+ const aspectRatio = videoWidth / videoHeight;
152
+
153
+ // Update aspect ratio and canvas size
154
+ setVideoAspectRatio(aspectRatio);
155
+ updateCanvasSize(aspectRatio);
156
+
157
+ console.log(`Camera switched with aspect ratio: ${aspectRatio}`);
158
+ };
159
+
160
  } catch (playError) {
161
  console.log("Play interrupted during camera switch:", playError);
162
  // Don't treat play interruptions as fatal errors
components/MainContent.js CHANGED
@@ -63,7 +63,11 @@ const MainContent = ({
63
  <canvas
64
  ref={canvasRef}
65
  className="rounded-lg shadow-lg w-full"
66
- style={{ height: `${canvasHeight}px` }}
 
 
 
 
67
  width={canvasWidth}
68
  height={canvasHeight}
69
  />
 
63
  <canvas
64
  ref={canvasRef}
65
  className="rounded-lg shadow-lg w-full"
66
+ style={{
67
+ height: `${canvasHeight}px`,
68
+ maxHeight: isMobile ? '70vh' : 'none',
69
+ objectFit: 'contain'
70
+ }}
71
  width={canvasWidth}
72
  height={canvasHeight}
73
  />
styles/globals.css CHANGED
@@ -70,6 +70,21 @@ body {
70
  }
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  /* Mobile-specific styles */
74
  @media (max-width: 767px) {
75
  .thought-bubble {
 
70
  }
71
  }
72
 
73
+ /* Canvas container styling */
74
+ .canvas-container {
75
+ position: relative;
76
+ width: 100%;
77
+ max-width: 100%;
78
+ overflow: hidden;
79
+ }
80
+
81
+ .canvas-container canvas {
82
+ display: block;
83
+ width: 100%;
84
+ height: auto;
85
+ object-fit: contain;
86
+ }
87
+
88
  /* Mobile-specific styles */
89
  @media (max-width: 767px) {
90
  .thought-bubble {