| | |
| | | const ctx = ctxRef.current! |
| | | const dataUnit8Array = recorder.current.getRecordAnalyseData() |
| | | const dataArray = [].slice.call(dataUnit8Array) |
| | | const lineLength = Number.parseInt(`${canvas.width / 3}`) |
| | | const gap = Number.parseInt(`${1024 / lineLength}`) |
| | | const lineLength = parseInt(`${canvas.width / 3}`) |
| | | const gap = parseInt(`${1024 / lineLength}`) |
| | | |
| | | ctx.clearRect(0, 0, canvas.width, canvas.height) |
| | | ctx.beginPath() |
| | |
| | | onConverted(audioResponse.text) |
| | | onCancel() |
| | | } |
| | | catch { |
| | | catch (e) { |
| | | onConverted('') |
| | | onCancel() |
| | | } |
| | |
| | | if (canvasRef.current && ctxRef.current) |
| | | drawRecord() |
| | | } |
| | | catch { |
| | | catch (e) { |
| | | onCancel() |
| | | } |
| | | } |
| | |
| | | } |
| | | }, []) |
| | | |
| | | const minutes = Number.parseInt(`${Number.parseInt(`${originDuration}`) / 60}`) |
| | | const seconds = Number.parseInt(`${originDuration}`) % 60 |
| | | const minutes = parseInt(`${parseInt(`${originDuration}`) / 60}`) |
| | | const seconds = parseInt(`${originDuration}`) % 60 |
| | | |
| | | return ( |
| | | <div className={cn(s.wrapper, 'absolute inset-0 rounded-xl')}> |
| | | <div className='absolute inset-[1.5px] flex items-center overflow-hidden rounded-[10.5px] bg-primary-25 py-[14px] pl-[14.5px] pr-[6.5px]'> |
| | | <canvas id='voice-input-record' className='absolute bottom-0 left-0 h-4 w-full' /> |
| | | <div className='absolute inset-[1.5px] flex items-center pl-[14.5px] pr-[6.5px] py-[14px] bg-primary-25 rounded-[10.5px] overflow-hidden'> |
| | | <canvas id='voice-input-record' className='absolute left-0 bottom-0 w-full h-4' /> |
| | | { |
| | | startConvert && <RiLoader2Line className='mr-2 h-4 w-4 animate-spin text-primary-700' /> |
| | | startConvert && <RiLoader2Line className='animate-spin mr-2 w-4 h-4 text-primary-700' /> |
| | | } |
| | | <div className='grow'> |
| | | { |
| | |
| | | { |
| | | startRecord && ( |
| | | <div |
| | | className='mr-1 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg hover:bg-primary-100' |
| | | className='flex justify-center items-center mr-1 w-8 h-8 hover:bg-primary-100 rounded-lg cursor-pointer' |
| | | onClick={handleStopRecorder} |
| | | > |
| | | <StopCircle className='h-5 w-5 text-primary-600' /> |
| | | <StopCircle className='w-5 h-5 text-primary-600' /> |
| | | </div> |
| | | ) |
| | | } |
| | | { |
| | | startConvert && ( |
| | | <div |
| | | className='mr-1 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg hover:bg-gray-200' |
| | | className='flex justify-center items-center mr-1 w-8 h-8 hover:bg-gray-200 rounded-lg cursor-pointer' |
| | | onClick={onCancel} |
| | | > |
| | | <RiCloseLine className='h-4 w-4 text-gray-500' /> |
| | | <RiCloseLine className='w-4 h-4 text-gray-500' /> |
| | | </div> |
| | | ) |
| | | } |