自定义制作音频播放器

You may not be old enough to remember the days of WinAmp, which was (in its original incarnation) a basic MP3 playback application with the killer feature of customizable themes. Today, we can create our own media player using HTML5 and JavaScript, customizing the appearance with CSS. Planning and building this player will allow developers to learn about HTML5 multimedia, JavaScript DataViews, and the WebAudio API.

您可能还不够大,无法记住WinAmp的时代,WinAmp最初是一个基本的MP3播放应用程序,具有可定制主题的杀手级功能。 今天,我们可以使用HTML5和JavaScript创建自己的媒体播放器,并使用CSS自定义外观。 规划和构建此播放器将使开发人员可以了解HTML5多媒体 ,JavaScript DataViews和WebAudio API

In this entry I’ll discuss the planning and design of the player’s interface; the remaining articles in the series will build the code.

在本条目中,我将讨论播放器界面的规划和设计。 本系列中的其余文章将构建代码。

基本玩家 (The Basic Player)

First, let’s assemble a reasonable feature list:

首先,让我们组装一个合理的功能列表:

  • Obviously, the code should play MP3 files: very achievable, now that Firefox supports the codec. To keep things simple, the player will have just one predefined track to start.

    显然,该代码应该可以播放MP3文件 :由于Firefox支持编解码器 ,这是可以实现的。 为了简单起见,播放器只有一个预定义的曲目可以开始。

  • We’ll need basic audio controls: play, pause, volume, and mute.

    我们需要基本的音频控制 : 播放 , 暂停 , 音量和静音 。

  • A progress bar should show how much music has played, and how much is left.

    进度条应显示播放了多少音乐,还剩多少。

  • A timer should show how much time is left on the track.

    计时器应显示轨道上还剩多少时间。

  • Another button should set the music track to loop infinitely. 另一个按钮应将音乐轨道设置为无限循环。
  • The track name, artist and album information should be displayed. (In the initial version of the player, this information will already be known.)

    曲目名称,艺术家和专辑信息应显示 。 (在播放器的初始版本中,此信息将是已知的。)

进阶玩家 (The Advanced Player)

It’s important to create a path for future improvements to the audio player. These will include:

为将来的音频播放器改进创建一条路径很重要。 这些将包括:

  • Clicks on the progress bar should advance and “rewind” the audio track. 单击进度栏上的应该可以前进和后退音轨。
  • The ability to load music tracks, and for those tracks to form playlists. For that to happen, we’ll need a Load button.

    加载音乐曲目,以及将这些曲目形成播放列表的能力。 为此,我们需要一个“ 加载”按钮。

  • Any ID3 metatag information in these tracks – name, year, artist, and album – will be read and displayed. 这些曲目中的所有ID3元标记信息(名称,年份,艺术家和专辑)都将被读取和显示。
  • A meter should show levels in the left and right audio channels. 仪表应在左右音频通道中显示电平。

功能与测试 (Functionality and Testing)

Because we have a growing list of functions, interaction should be carefully considered, even in the simple player.

因为我们的功能列表越来越多,所以即使在简单的播放器中,也应仔细考虑交互。

  • The interface should be simple: the Play button should swap to a pause state when clicked, rather than presenting the user with separate buttons for each action.

    界面应该简单:单击“ 播放”按钮时应切换到暂停状态,而不是为用户显示每个操作单独的按钮。

  • Clicking Mute should set the volume slider to 0 and pause playback. Clicking the same button again should resume playback at the previous volume.

    单击静音应将音量滑块设置为0并暂停播放。 再次单击相同的按钮应以先前的音量恢复播放。

  • When the track has finished playing, it should rewind to its beginning and shift to paused, unless the Loop button is on.

    曲目播放完毕后,除非打开“ 循环播放”按钮,否则应倒回其开头并切换至暂停状态。

The advanced functions should also be tested, to know that they can be achieved.

还应该测试高级功能,以了解它们可以实现。

资源资源 (Resources)

It’s important to know what resources and content you have to hand before starting a project. In this case, I have the following:

在开始一个项目之前,必须要掌握什么资源和内容,这一点很重要。 在这种情况下,我有以下内容:

  • A music track by Nine Inch Nails, licensed under Creative Commons. Nine Inch Nails发行的音乐曲目,已获得知识共享许可。
  • The HTML5 <audio> and <progress> elements, with supporting JavaScript.

    HTML5 <audio><progress>元素,并支持JavaScript。

  • PNG files for the buttons and background of the player, based on initial sketches. 基于初始草图的PNG文件,用于播放器的按钮和背景。

初步设计 (Initial Design)

I always prefer to work with pen and paper to start, just to rough in the design. Shown in the header for this article are some initial sketches, on GridBooks pages (a tool I’ll introduce in the very near future).

我总是更喜欢使用笔和纸开始设计,只是为了粗略设计。 本文的标题中显示了GridBooks页面上的一些初始草图(我将在不久的将来介绍该工具)。

扩展性和可访问性 (Expansion & Accessibility)

It’s important to plan for maintenance, accessibility and expansion of your code. To this end, I’ll be writing clearly defined functions in my JavaScript, with HTML & CSS to match, together with accessibility affordances. Ideally, audio with spoken content or lyrics would be captioned, although that will take a separate series of articles.

计划维护,可访问性和代码扩展很重要 。 为此,我将在JavaScript中编写明确定义的函数,并匹配HTML和CSS,以及可访问性。 理想情况下,将对带有语音内容或歌词的音频进行字幕,尽管这将需要单独的系列文章。

翻译自: https://thenewcode.com/877/Making-An-Audio-Player-With-HTML5-Part-1-Features-and-Design

自定义制作音频播放器

自定义制作音频播放器_使用HTML5制作音频播放器,第1部分:功能和设计相关推荐

  1. 带倍速播放的播放器_带有HTML5的MP3播放器

    带倍速播放的播放器 MP3 Player with HTML5 In you are a beginner in HTML5 and you are looking for new knowledge ...

  2. 自定义制作音频播放器_使用HTML5制作音频播放器,第3部分:微数据和皮肤

    自定义制作音频播放器 In the first two articles of this series I introduced the concept and code of a customize ...

  3. html音乐播放器代码自动,html5 css3音乐播放器代码

    特效描述:html5 css3 音乐播放器代码.html5 css3音乐播放器代码 代码结构 1. 引入CSS 2. 引入JS 3. HTML代码 标题歌手 00:00/00:00 var music ...

  4. 用html制作个人站点,【制作个人网站】如何在网上制作自己的网页?如何用html5制作个人主页?制作个人网页设计思路是怎样的?...

    [制作个人网站]如何在网上制作自己的网页?如何用html5制作个人主页?制作个人网页设计思路是怎样的?下面就和小编一起来看看吧! 如何在网上制作自己的网页? 网站设计的八个步骤现在看到的工具越来越多, ...

  5. html5中音乐播放器怎么写,html5简单音乐播放器

    自己写的一个简单的音乐播放器, 主要实现了控制播放暂停,时间显示,音乐进度条点击以及拖动改变播放进度效果. 基于jquery编写,需要引入jquery. HTML: 00:00:00 00:00:00 ...

  6. 计算机基础应用软件ppt制作,大学计算机基础_演示文稿制作软件.ppt

    大学计算机基础_演示文稿制作软件资料 插入影片和声音 插入影片 插入声音 播放CD乐曲 录制声音 5.5 演示文稿中的动画和超链接技术 5.5.1 为幻灯片加入动画效果 5.5.2 创建超级链接 为幻 ...

  7. 电脑PHP动画制作画板,HTML_html5教程制作简单画板代码分享,HTML5制作简单画板 复制代码代 - phpStudy...

    html5教程制作简单画板代码分享 HTML5制作简单画板 复制代码代码如下: http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min ...

  8. 制作mysql rpm包_一步步制作RPM包

    一.RPM制作步骤 我们在企业中有的软件基本都是编译的,我们每次安装都得编译,那怎么办呢?那就根据我们的需求制作RPM安装包吧.先来说说基本布骤: 1.Planning what you want   ...

  9. 制作唐诗网页代码_分享FrontPage制作网页的几个技巧

    最近笔者学会了用FrontPage XP做网页,心理特高兴,非常想把我在制作主页过程中的一些经验和大家交流交流.切磋切磋,我们一起来看看吧. 用表格做按钮 很多人为了做出按钮效果,不得不去动用一些图像 ...

  10. epub 阅读器_全球与中国EPUB阅读器市场深度调研分析报告

    QYResearch预测:2020-2026全球与中国EPUB阅读器市场现状及未来发展趋势 [纸版价格]:RMB 18000 [电子版(PDF)价格]:RMB 18000 [报告篇幅]:103 [报告 ...

最新文章

  1. 移动端大图缩放模糊_关于移动端小图标模糊问题的解决方法
  2. java学习笔记(二) ----基本数据类型应用
  3. dubbo service注解用法_Dubbo---开源分布式服务框架(一)
  4. DL:神经网络算法简介之Affine 层的简介、使用方法、代码实现之详细攻略
  5. leetcode —— 938. 二叉搜索树的范围和
  6. 柳传志:33年来,联想这13条管理经验从未改变
  7. 8 年经验面试官解读程序员的技能瓶颈,以及突破瓶颈的忠告 | CSDN 博文精选
  8. 哪款scrm系统性价比更高?更受企业的欢迎?
  9. 从零学光学设计 zemax中的三种优化
  10. 提高百度网盘下载速度的方法
  11. 加拿大计算机工程研究生,加拿大维多利亚大学电子与计算机工程系副教授诚招硕士研究生 - 导师招生 - 小木虫 - 学术 科研 互动社区...
  12. linux -shell编程-循环语句
  13. AR、VR、MR、CR的意思
  14. 我对refactoring的思考
  15. STM32F407 ADC+DMA+定时器 定时采样模拟量
  16. 伯特兰·阿瑟·威廉·罗素
  17. Error occurred while trying to proxy request项目突然起不来了
  18. echart旭日图_echarts(10):旭日图
  19. 面试:Zookeeper常见11个连环炮
  20. Java数据类型和运算符

热门文章

  1. golang 时间格式转换汇总
  2. CSDN删除上传资源操作
  3. 【FPGA的基础快速入门31-----环境光传感器】
  4. DNX451 与 DNXCORE50 获取当前应用程序目录
  5. 微信开放平台 公众号第三方平台开发C#
  6. ​【NeurIPS 2022】IPMT:用于小样本语义分割的中间原型挖掘Transformer
  7. 微信企业号开发:openapi回调地址请求不通过
  8. 错误代码warning C4013: ‘sqrt‘ undefined; assuming extern returning int怎么解决?
  9. antv/G6和antv/X6
  10. 三极管原理及贴片封装注意