Skip to content

Commit

Permalink
docs: set explicit mime type when creating a blob
Browse files Browse the repository at this point in the history
  • Loading branch information
OrbisK committed Nov 28, 2024
1 parent 7171ecf commit 39f1089
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/basic-example.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
stop,
pause,
resume,
mimeType,
state,
} = useMediaRecorder({ constraints: { audio: true } })
Expand Down Expand Up @@ -42,7 +43,7 @@ function handleStartClick() {
const audio = computed(() => {
if (!data.value?.length || state.value !== 'inactive')
return
const blob = new Blob(data.value)
const blob = new Blob(data.value, {type: mimeType.value})
return URL.createObjectURL(blob)
})
</script>
Expand Down
5 changes: 5 additions & 0 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ outline: deep

# Examples

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

## Basic Example

This is a basic example of how to use the `<script setup>` syntax in a Vue component.
Expand Down
3 changes: 2 additions & 1 deletion docs/timeslice-example.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
stop,
pause,
resume,
mimeType,
state,
} = useMediaRecorder({ constraints: { audio: true } })
Expand Down Expand Up @@ -44,7 +45,7 @@ function handleStartClick() {
const audio = computed(() => {
if (!data.value?.length || state.value !== 'inactive')
return
const blob = new Blob(data.value)
const blob = new Blob(data.value, {type: mimeType.value})
return URL.createObjectURL(blob)
})
</script>
Expand Down
1 change: 1 addition & 0 deletions vitest.workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default defineWorkspace([
browser: {
enabled: true,
name: 'chromium',
headless: true,
provider: 'playwright',
providerOptions: {
context: {
Expand Down

0 comments on commit 39f1089

Please sign in to comment.