javascript jPlayer 和 Shoutcast 配置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8786563/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 04:34:24  来源:igfitidea点击:

jPlayer and Shoutcast Configuration

javascriptjqueryjplayershoutcast

提问by Benjamin

I am trying to set up JPlayer plugin and Shoutcast. According to their website this is possible to do.

我正在尝试设置 JPlayer 插件和 Shoutcast。根据他们的网站,这是可能的。

How do I get jPlayer to play a SHOUTCast stream? You need to setMedia to the stream URL. For example, SHOUTcast server: http://mp3-vr-128.as34763.net/MP3 stream URL: http://mp3-vr-128.as34763.net/;stream/1

如何让 jPlayer 播放 SHOUTCast 流?您需要将媒体设置为流 URL。例如SHOUTcast服务器:http: //mp3-vr-128.as34763.net/MP3流网址:http: //mp3-vr-128.as34763.net/;stream/1

I have tried to do this

我试过这样做

<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){

    $("#jquery_jplayer_1").jPlayer({
        ready: function (event) {
            $(this).jPlayer("setMedia", {
                m4a:"http://77.68.106.224:8018;stream/1",
                oga:"http://77.68.106.224:8018"
            }).jPlayer("play");
        },


        swfPath: "js",
        supplied: "m4a, oga, mp3", 
        wmode: "window"
    });
});
//]]>
</script>

I do not get any output with my settings. Is anyone using JPlayer for a shoutcast Stream, or can anyone suggest a player that doesn't need php.

我的设置没有得到任何输出。有没有人使用 JPlayer 进行喊叫流,或者任何人都可以推荐一个不需要 php.ini 的播放器。

采纳答案by Lloyd

sweet vibes on this station!

这个站的甜蜜氛围!

You're almost there, see this fiddleto see your stream working in jPlayer.. Shoutcast outputs audio in MP3 format, not M4a or OGG.. you need constructor code more like that below..

你快到了,看到这个小提琴,看看你的流在 jPlayer 中工作.. Shoutcast 以 MP3 格式输出音频,而不是 M4a 或 OGG.. 你需要更像下面的构造函数代码..

One important thing to know is that the Flash plugin when using IE8 sometimes spends minutesbuffering the audio.. You click play, think it isn't working then suddenly find your audio starts playing after three minutes.. The good news is that Chrome, Safari and Firefox play the stream almost immediately.

需要知道的一件重要事情是,使用 IE8 时 Flash 插件有时会花费几分钟来缓冲音频。您单击播放,认为它不起作用,然后突然发现您的音频在三分钟后开始播放。好消息是 Chrome, Safari 和 Firefox 几乎立即播放流。

<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){

    $("#jquery_jplayer_1").jPlayer({
        ready: function (event) {
            $(this).jPlayer("setMedia", {
                mp3:"http://77.68.106.224:8018;stream/1"
            }).jPlayer("play");
        },


        swfPath: "js",
        supplied: "mp3", 
        wmode: "window"
    });
});
//]]>
</script>

回答by Tim Reed

Don't know if you still need a solution. We used the j player in the past but with Chrome updates and problems with flash and other browsers, Win 10 and flash issues we moved away from it. DO NOT CHANGE ANY PUNCUATIONS. Just paste the code into your website.

不知道您是否还需要解决方案。我们过去使用过 j 播放器,但由于 Chrome 更新以及 Flash 和其他浏览器的问题、Win 10 和 Flash 问题,我们放弃了它。请勿更改任何标点符号。只需将代码粘贴到您的网站即可。

We now use a simple media player code. You'll have to put in your IP and Port #.

我们现在使用一个简单的媒体播放器代码。您必须输入您的 IP 和端口号。

     <div id="wb_MediaPlayer1">
<audio src="http://YOUR IP ADDRESS:YOUR PORT/;" id="MediaPlayer1" autoplay="autoplay" controls="controls">
</audio></div>

This code is included in our Widgets service at My Radio Hostingif you would like to take a look.

如果您想看一看,此代码包含在My Radio Hosting 的小部件服务中。

Hope this helps!

希望这可以帮助!