Skip to content

Commit 2ebc005

Browse files
Add: CodeSandboxes 114. & 115.
1 parent 57bd5eb commit 2ebc005

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4160,6 +4160,12 @@ The Audio and Video API allows web applications to embed and control audio and v
41604160
</video>
41614161
```
41624162

4163+
[![Edit 114-Audio and Video API](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/sandbox/114-audio-and-video-api-zzyzjg)
4164+
4165+
- [^114]CodeSandbox: Audio and Video API.
4166+
4167+
[^114]:[CodeSandbox: Audio and Video API.](https://zzyzjg.csb.app/), last access: October 6, 2024.
4168+
41634169
- The code above demonstrates how to use the `<audio>` and `<video>` elements to embed audio and video content.
41644170
- The `controls` attribute adds playback controls (play, pause, volume, etc.) to the media player.
41654171
- Multiple `<source>` elements can be included to provide alternative formats or sources for the media content, ensuring compatibility with different browsers and devices.
@@ -4174,8 +4180,8 @@ The File API enables web applications to access and manipulate files on the user
41744180

41754181
<script>
41764182
function handleFile(event) {
4177-
var file = event.target.files[0];
4178-
var reader = new FileReader();
4183+
const file = event.target.files[0];
4184+
const reader = new FileReader();
41794185
reader.onload = function(e) {
41804186
document.getElementById("fileContents").textContent = e.target.result;
41814187
};
@@ -4184,6 +4190,12 @@ function handleFile(event) {
41844190
</script>
41854191
```
41864192

4193+
[![Edit 115-File API](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/sandbox/115-file-api-69c6jw)
4194+
4195+
- [^115]CodeSandbox: File API.
4196+
4197+
[^115]:[CodeSandbox: File API.](https://69c6jw.csb.app/), last access: October 6, 2024.
4198+
41874199
- The code above demonstrates how to use the File API to read the contents of a file selected by the user.
41884200
- When a file is selected using the `<input type="file">` element, the `onchange` event is triggered, calling the `handleFile()` function.
41894201
- Inside the `handleFile()` function, a `FileReader` object is created to read the contents of the selected file.

0 commit comments

Comments
 (0)