Skip to content

Commit 98ceb6a

Browse files
committed
Fixed webm duration. Code simplified.
- Fixed output webm metadata - Added audio switch, still needs to be improved - Notification fixed - General code simplifications
1 parent c95fb38 commit 98ceb6a

File tree

6 files changed

+163
-78
lines changed

6 files changed

+163
-78
lines changed

package-lock.json

Lines changed: 66 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"dependencies": {
3636
"electron-store": "^8.0.1",
3737
"react": "^17.0.2",
38-
"react-dom": "^17.0.2"
38+
"react-dom": "^17.0.2",
39+
"webm-fix-duration": "^1.0.1"
3940
},
4041
"devDependencies": {
4142
"@types/react": "^17.0.38",
@@ -45,13 +46,13 @@
4546
"@vitejs/plugin-react": "^1.1.4",
4647
"electron": "^16.0.8",
4748
"electron-builder": "^22.14.5",
48-
"eslint": "8.7.0",
49+
"eslint": "8.8.0",
4950
"eslint-plugin-react": "^7.28.0",
5051
"eslint-plugin-react-hooks": "^4.3.0",
5152
"sass": "^1.49.0",
5253
"typescript": "^4.5.5",
5354
"vite": "^2.7.13",
54-
"vite-plugin-resolve": "^1.4.0"
55+
"vite-plugin-resolve": "^1.4.2"
5556
},
5657
"env": {
5758
"HOST": "127.0.0.1",

packages/main/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ if (!app.requestSingleInstanceLock()) {
1818
}
1919

2020
let win: BrowserWindow | null = null
21+
app.commandLine.appendSwitch('enable-webgl')
2122

2223
const createWindow = async () => {
2324
win = new BrowserWindow({
24-
title: 'Screencast',
25+
title: 'Lucast',
2526
width: 1280,
2627
height: 720,
2728
minWidth: 940,

packages/main/samples/save-recording.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,28 @@ import { dialog, ipcMain } from 'electron'
22
import { writeFile } from 'fs'
33

44
ipcMain.on('save-blob', async (event, blob) => {
5-
const date = new Date()
65
const { filePath } = await dialog.showSaveDialog({
76
title: 'Save your recording',
87
buttonLabel: 'Save',
9-
defaultPath: `lucast-${date.getTime()}.webm`,
8+
defaultPath: `lucast-${Date.now()}.webm`,
109
filters: [{ name: 'Movies', extensions: ['webm'] }],
1110
})
1211
if (filePath)
1312
writeFile(filePath, Buffer.from(blob), () =>
1413
console.log('Video saved!')
1514
)
1615
})
16+
17+
ipcMain.handle('create-buffer', async (event, blob) => {
18+
return Buffer.from(await blob.arrayBuffer())
19+
})
20+
21+
ipcMain.handle('get-save-path', async (event, ext) => {
22+
const { filePath } = await dialog.showSaveDialog({
23+
title: 'Save your recording',
24+
buttonLabel: 'Save',
25+
defaultPath: `lucast-${Date.now()}.${ext}`,
26+
filters: [{ name: 'Movies', extensions: [ext] }],
27+
})
28+
if (filePath) return filePath
29+
})

packages/renderer/src/components/Modals/SettingsModal.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ const SettingsModal = ({ onClose }: SettingsModalInterface) => {
148148
<select value={videoSettings?.format.toUpperCase()}>
149149
<option>WEBM</option>
150150
<option disabled>MP4</option>
151+
<option disabled>GIF</option>
152+
<option disabled>APNG</option>
153+
<option disabled>WEBP</option>
151154
</select>
152155
<span>Video format</span>
153156
</div>

0 commit comments

Comments
 (0)