1
1
import styles from '../styles/Record.module.css' ;
2
- import { useState , useMemo } from 'react' ;
2
+ import { useState } from 'react' ;
3
3
import axios from 'axios' ;
4
4
5
5
const Record = ( ) => {
@@ -31,11 +31,11 @@ const Record = () => {
31
31
} ) ;
32
32
33
33
newMediaRecorder . addEventListener ( "stop" , ( ) => {
34
- const audioBlob = new Blob ( audioChunks , { 'type' : 'audio/wav ' } ) ;
34
+ const audioBlob = new Blob ( audioChunks , { 'type' : 'audio/webm ' } ) ;
35
35
const audioUrl = URL . createObjectURL ( audioBlob ) ;
36
36
const audio = new Audio ( audioUrl ) ;
37
- const file = new File ( audioChunks , "test.wav " , {
38
- type : "audio/wav " ,
37
+ const file = new File ( audioChunks , "test.webm " , {
38
+ type : "audio/webm " ,
39
39
} ) ;
40
40
setAudioBlob ( file ) ;
41
41
setBlobURL ( audioUrl ) ;
@@ -52,7 +52,7 @@ const Record = () => {
52
52
} ;
53
53
54
54
async function uploadToGCloud ( file , type , unique_id ) {
55
- const filename = `${ type } -${ unique_id } .${ type === 'audio' ? 'wav ' : 'pdf' } ` ;
55
+ const filename = `${ type } -${ unique_id } .${ type === 'audio' ? 'webm ' : 'pdf' } ` ;
56
56
57
57
try {
58
58
const response = await axios . post ( '/api/gcloudUpload' , {
@@ -112,7 +112,7 @@ const Record = () => {
112
112
113
113
try {
114
114
const formData = new FormData ( ) ;
115
- formData . append ( "audio" , audioBlob , 'demo.wav ' ) ; // Set the filename to "demo.wav "
115
+ formData . append ( "audio" , audioBlob , 'demo.webm ' ) ; // Set the filename to "demo.webm "
116
116
117
117
// 1) Generate unique id
118
118
const unique_id = generateUniqueBigInt ( ) ;
0 commit comments