Skip to content

Commit 627d144

Browse files
committed
Update [Part 2 / Bindings / Media elements]
Used even more shorthand forms ( {src} ) and explained, that to src we don't have to bind.
1 parent c89b709 commit 627d144

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

content/tutorial/02-advanced-svelte/05-bindings/03-media-elements/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ title: Media elements
44

55
You can bind to properties of `<audio>` and `<video>` elements, making it easy to (for example) build custom player UI, like `AudioPlayer.svelte`.
66

7-
First, add the `<audio>` element along with its bindings (we'll use the shorthand form for `duration` and `paused`):
7+
First, add the `<audio>` element along with its bindings (we'll use the shorthand form for `src`, `duration` and `paused`, and to `src` we don't have to bind):
88

99
```svelte
1010
/// file: AudioPlayer.svelte
1111
<div class="player" class:paused>
1212
+++ <audio
13-
src={src}
13+
{src}
1414
bind:currentTime={time}
1515
bind:duration
1616
bind:paused
@@ -53,7 +53,7 @@ When the track ends, be kind — rewind:
5353
```svelte
5454
/// file: AudioPlayer.svelte
5555
<audio
56-
src={src}
56+
{src}
5757
bind:currentTime={time}
5858
bind:duration
5959
bind:paused

content/tutorial/02-advanced-svelte/05-bindings/03-media-elements/app-b/src/lib/AudioPlayer.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<div class="player" class:paused>
2121
<audio
22-
src={src}
22+
{src}
2323
bind:currentTime={time}
2424
bind:duration
2525
bind:paused

0 commit comments

Comments
 (0)