File size: 632 Bytes
d61897b
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { useEffect } from 'react'
import { exportMp4 } from './exporter'

export default function XDebug() {
  useEffect(() => {
    const w = window as unknown as { __done: boolean; __mp4: string }
    exportMp4(24, () => {}, new AbortController().signal, 3).then(async b => {
      const u8 = new Uint8Array(await b.arrayBuffer()); let bin = ''
      for (let i = 0; i < u8.length; i += 0x8000) bin += String.fromCharCode(...u8.subarray(i, i + 0x8000))
      w.__mp4 = btoa(bin); console.log('INFO mp4 bytes ' + b.size)
    }).catch(e => console.log('INFO ERROR ' + e)).finally(() => { w.__done = true })
  }, [])
  return null
}