音频标签GUI中不可见 [英] Audio tag GUI not visible

查看:265
本文介绍了音频标签GUI中不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经包含一个页面上的音频标记为

I have included the audio tag on a page as

<audio src='a.mp3' preload='auto'>
</audio>

但它没有工作,我不能看到页面上的任何东西。

but its not working, i can't see anything on the page.

但是,当我有audiojs为

But when i include audiojs as

  <script src="/static/js/audiojs/audio.min.js"></script>
  <script>
    audiojs.events.ready(function() {
      var as = audiojs.createAll();
    });

  </script>

我在想为什么会这样呢?

I am left wondering why is that so ?

推荐答案

据我了解,SRC是内部音频的元素,而不是一个属性。所以,你的code应该是这样的:

From what I've learned, src is an element inside audio, not an attribute. So your code should look like this:

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

(来源)

编辑: SRC也可以是一个属性,所以这是不是你的问题。为了让浏览器显示的任何的音频,你需要控制属性。但是,如果你不想默认控件,添加HTML按钮和控制启动/停止等使用JavaScript的音频。

src can also be an attribute, so that wasn't your problem. In order for the browser to display anything for audio, you need the "controls" attribute. However, if you don't want the default controls, add html buttons and control the start/stop etc. of the audio with JavaScript.

这篇关于音频标签GUI中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆