构建多媒体播放器

发布: (2026年2月11日 GMT+8 19:00)
2 分钟阅读
原文: Dev.to

Source: Dev.to

HTML 模板

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Multimedia Player</title>
</head>
<body>
  <!-- Your player markup will go here -->
</body>
</html>

音频元素示例

<audio controls>
  <source src="path/to/audio.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>

视频元素示例

<video controls width="640" height="360">
  <source src="path/to/video.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

完成的实验代码

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Multimedia Player</title>
</head>
<body>

  <section id="player">
    <h2>Multimedia Player</h2>

    <article>
      <h3>Now Playing: Sailing Away</h3>

      <audio controls>
        <source src="sailing-away.mp3" type="audio/mpeg">
        Use the play button to start the audio track. Use pause to stop it. Use volume controls to adjust sound.
      </audio>
    </article>

    <section>
      <h3>What is the map method and how does it work?</h3>
      <!-- Content about the map method -->
    </section>

    <section>
      <h3>Transcript</h3>
      <p>
        What is the map method, and how does it work? The map method is a widely used and powerful function in JavaScript that works on arrays. It creates a new array by applying a specified function to each element of the original array. The original array remains unchanged, while the new array contains the results of the function applied to each element.
      </p>
    </section>
  </section>

</body>
</html>

我真的很喜欢这三个专注于可访问性的实验。我现在有一个可访问性审查和测验要完成,然后再去挑战整个 HTML 章节的测验。我下次会分享更多关于那个审查的内容——在此之前,继续编码吧!

0 浏览
Back to Blog

相关文章

阅读更多 »

Go 模板

什么是 Go 模板?Go 模板是一种在 Go 中通过将数据与纯文本或 HTML 文件混合来创建动态内容的方式。它们允许您替换占位符……