shiveshnavin commited on
Commit
07361d6
·
1 Parent(s): a718b48

Performance fixes

Browse files
src/ig-reel/IGMediaRender.tsx CHANGED
@@ -8,7 +8,7 @@ import Transitions from '../../public/assets/transitions.json'
8
  import { RenderUtils } from "../RenderUtils";
9
 
10
 
11
- export function IGMediaRender(props: { curZoom: number, displayMedia: DisplayMedia }) {
12
  let displayMedia: DisplayMedia = props.displayMedia
13
  let bgMediaPath = staticFile(displayMedia?.path || '')
14
  let curZoom = props.curZoom
@@ -28,12 +28,30 @@ export function IGMediaRender(props: { curZoom: number, displayMedia: DisplayMed
28
  position: 'relative',
29
  height: '100%', width: '100%'
30
  }}>
31
- <Video playbackRate={1} volume={0} style={{
32
- background: '#fff',
33
- position: 'absolute',
34
- objectFit: 'cover',
35
- height: '100%', width: '100%'
36
- }} src={bgMediaPath} />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  </div>
38
  ) : (
39
  <Img className='absolute inset-0 w-full h-full object-cover' style={{
 
8
  import { RenderUtils } from "../RenderUtils";
9
 
10
 
11
+ export function IGMediaRender(props: { curZoom: number, displayMedia: DisplayMedia, offThreadVideo?: boolean }) {
12
  let displayMedia: DisplayMedia = props.displayMedia
13
  let bgMediaPath = staticFile(displayMedia?.path || '')
14
  let curZoom = props.curZoom
 
28
  position: 'relative',
29
  height: '100%', width: '100%'
30
  }}>
31
+ {
32
+ props.offThreadVideo ?
33
+ <OffthreadVideo
34
+ toneMapped={false}
35
+ playbackRate={1}
36
+ volume={0}
37
+ style={{
38
+ background: '#fff',
39
+ position: 'absolute',
40
+ objectFit: 'cover',
41
+ height: '100%',
42
+ width: '100%',
43
+ }}
44
+ src={bgMediaPath}
45
+ />
46
+ :
47
+ <Video playbackRate={1} volume={0} style={{
48
+ background: '#fff',
49
+ position: 'absolute',
50
+ objectFit: 'cover',
51
+ height: '100%', width: '100%'
52
+ }} src={bgMediaPath} />
53
+ }
54
+
55
  </div>
56
  ) : (
57
  <Img className='absolute inset-0 w-full h-full object-cover' style={{
src/ig-reel/IGSimpleScene.tsx CHANGED
@@ -186,7 +186,7 @@ export const IGSimpleScene: React.FC<any> = (props: {
186
  }
187
  chunk.push((
188
  <TransitionSeries.Sequence durationInFrames={duration}>
189
- <IGMediaRender curZoom={curZoom} displayMedia={displayMedia} />
190
  </TransitionSeries.Sequence>
191
  ))
192
  if (i < item?.mediaAbsPaths.length - 1 || true) {
@@ -239,7 +239,7 @@ export const IGSimpleScene: React.FC<any> = (props: {
239
  nextSceneMedia0 && (
240
  <TransitionSeries.Sequence durationInFrames={itemDurationInFrames}>
241
  <Freeze frame={1}>
242
- <IGMediaRender curZoom={1} displayMedia={nextSceneMedia0} />
243
  </Freeze>
244
  </TransitionSeries.Sequence>
245
  )
 
186
  }
187
  chunk.push((
188
  <TransitionSeries.Sequence durationInFrames={duration}>
189
+ <IGMediaRender offThreadVideo={true} curZoom={curZoom} displayMedia={displayMedia} />
190
  </TransitionSeries.Sequence>
191
  ))
192
  if (i < item?.mediaAbsPaths.length - 1 || true) {
 
239
  nextSceneMedia0 && (
240
  <TransitionSeries.Sequence durationInFrames={itemDurationInFrames}>
241
  <Freeze frame={1}>
242
+ <IGMediaRender offThreadVideo={true} curZoom={1} displayMedia={nextSceneMedia0} />
243
  </Freeze>
244
  </TransitionSeries.Sequence>
245
  )
src/index.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { registerRoot } from 'remotion';
2
  import { Compositions } from "./Compositions";
 
3
 
4
-
5
- registerRoot(Compositions);
 
 
1
  import { Compositions } from "./Compositions";
2
+ import { continueRender, delayRender, registerRoot } from "remotion";
3
 
4
+ registerRoot(Compositions);