Skip to content

Commit 39f1089

Browse files
committed
docs: set explicit mime type when creating a blob
1 parent 7171ecf commit 39f1089

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

docs/basic-example.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const {
88
stop,
99
pause,
1010
resume,
11+
mimeType,
1112
state,
1213
} = useMediaRecorder({ constraints: { audio: true } })
1314
@@ -42,7 +43,7 @@ function handleStartClick() {
4243
const audio = computed(() => {
4344
if (!data.value?.length || state.value !== 'inactive')
4445
return
45-
const blob = new Blob(data.value)
46+
const blob = new Blob(data.value, {type: mimeType.value})
4647
return URL.createObjectURL(blob)
4748
})
4849
</script>

docs/examples.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ outline: deep
44

55
# Examples
66

7+
::: warning
8+
Due to a [bug in WebKit (Safari)](https://bugs.webkit.org/show_bug.cgi?id=198015), the `<audio>` source blob does only
9+
work if you set an explicit `type` attribute. This is not a problem with the composable, but with the browser itself.
10+
:::
11+
712
## Basic Example
813

914
This is a basic example of how to use the `<script setup>` syntax in a Vue component.

docs/timeslice-example.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const {
88
stop,
99
pause,
1010
resume,
11+
mimeType,
1112
state,
1213
} = useMediaRecorder({ constraints: { audio: true } })
1314
@@ -44,7 +45,7 @@ function handleStartClick() {
4445
const audio = computed(() => {
4546
if (!data.value?.length || state.value !== 'inactive')
4647
return
47-
const blob = new Blob(data.value)
48+
const blob = new Blob(data.value, {type: mimeType.value})
4849
return URL.createObjectURL(blob)
4950
})
5051
</script>

vitest.workspace.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default defineWorkspace([
99
browser: {
1010
enabled: true,
1111
name: 'chromium',
12+
headless: true,
1213
provider: 'playwright',
1314
providerOptions: {
1415
context: {

0 commit comments

Comments
 (0)