【问题标题】:HTML 5 Shoutcast Stream not workingHTML 5 Shoutcast Stream 不起作用
【发布时间】:2015-01-02 20:23:13
【问题描述】:

所以,我有一个相当简单的设置。

本站可以查看here

图标的引导库是here

<head>
    <style>
        #pButton{
            height:60px;
            width: 60px;
            border: none;
            background-size: 50% 50%;
            background-position: center;
        }
    </style>
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min$
    <link href="css/ripples.min.css" rel="stylesheet">
    <link href="css/material-wfont.min.css" rel="stylesheet">
</head>
<body>
    <div class="container">
        <audio id="music">
            <source src="http://listen.fillyradio.com:8006/;stream" type="audio/mpeg" />
        </audio>
        <div id="audioplayer">
            <button id="pButton" class="mdi-av-play-circle-outline" onclick"play()"></button>
        </div>
    </div>
    <script>
        // variable to store HTML5 audio element
        var music = document.getElementById('music');

        function play() {
            if (music.paused) {
                music.play();
                pButton.className = "";
                pButton.className = "mdi-av-pause-circle-outline";
            } else {
                music.pause();
                pButton.className = "";
                pButton.className = "mdi-av-play-circle-outline";
            }
        }
    </script>
</body>

我的问题?播放器在启用控件的情况下工作正常,但我希望能够使用自定义控件,而不是默认浏览器控件。

按钮点击,但不模仿音频或更改图标。

有什么想法吗?

【问题讨论】:

  • 您在控制台中看到任何错误吗?加上您加载引导库的链接似乎不正确

标签: javascript html twitter-bootstrap shoutcast


【解决方案1】:
<button id="pButton" class="mdi-av-play-circle-outline" onclick"play()"></button> 

你需要 = 在你的 onclick 之后

<button id="pButton" class="mdi-av-play-circle-outline" onclick="play()"></button>

【讨论】:

  • 谢谢!当我们在深夜爆破代码时,我们会错过最愚蠢的事情
  • 发生在我们最好的人身上;)
猜你喜欢
  • 2014-10-12
  • 1970-01-01
  • 1970-01-01
  • 2014-08-07
  • 1970-01-01
  • 2011-10-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多