10000 trying with webm file type · chriscarrollsmith/session-scribe@a73f9dc · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Aug 19, 2024. It is now read-only.

Commit a73f9dc

Browse files
trying with webm file type
1 parent 3e426d5 commit a73f9dc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pages/record.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styles from '../styles/Record.module.css';
2-
import { useState, useMemo } from 'react';
2+
import { useState } from 'react';
33
import axios from 'axios';
44

55
const Record = () => {
@@ -31,11 +31,11 @@ const Record = () => {
3131
});
3232

3333
newMediaRecorder.addEventListener("stop", () => {
34-
const audioBlob = new Blob(audioChunks, { 'type' : 'audio/wav' });
34+
const audioBlob = new Blob(audioChunks, { 'type' : 'audio/webm' });
3535
const audioUrl = URL.createObjectURL(audioBlob);
3636
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",
3939
});
4040
setAudioBlob(file);
4141
setBlobURL(audioUrl);
@@ -52,7 +52,7 @@ const Record = () => {
5252
};
5353

5454
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'}`;
5656

5757
try {
5858
const response = await axios.post('/api/gcloudUpload', {
@@ -112,7 +112,7 @@ const Record = () => {
112112

113113
try {
114114
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"
116116

117117
// 1) Generate unique id
118118
const unique_id = generateUniqueBigInt();

0 commit comments

Comments
 (0)
0