Skip to content

Commit

Permalink
Fix seeking in review & trim step
Browse files Browse the repository at this point in the history
Aims at fixing or at least helping with #517.

As suggested in #517, this introduces the
webm-duration-fix package to Studio. This should
fix the "Preview & Trim" step on Chrome (desktop),
allowing for playback and seeking in the recorded
video. Furthermore, the duration should now
be stored correctly in the video metadata.

This should not change behaviour in Firefox, as
it was already working in Firefox. I have not tested
other browsers.

Note that recordings downloaded directly from
Chrome may still not be playable by all and every
media player. This is not something this PR can fix.
  • Loading branch information
Arnei committed Sep 5, 2024
1 parent 8351953 commit 5bc70ef
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 2 deletions.
86 changes: 86 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"react-icons": "^4.12.0",
"react-select": "^5.8.0",
"use-resize-observer": "^9.1.0",
"webm-duration-fix": "^1.0.4",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4"
},
Expand Down
5 changes: 3 additions & 2 deletions src/steps/recording/recorder.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fixWebmDuration from "webm-duration-fix";
import { Settings } from "../../settings";
import { dimensionsOf } from "../../util";

Expand Down Expand Up @@ -61,9 +62,9 @@ export default class Recorder {
}
};

#onStop = (_event: Event) => {
#onStop = async (_event: Event) => {
const mimeType = this.#data[0]?.type || this.#recorder.mimeType;
const media = new Blob(this.#data, { type: mimeType });
const media = await fixWebmDuration(new Blob(this.#data, { type: mimeType }));
const url = URL.createObjectURL(media);

this.#reset();
Expand Down

0 comments on commit 5bc70ef

Please sign in to comment.