收听来自网络的广播流

发布于 2024-12-02 12:52:28 字数 1422 浏览 2 评论 0原文

我尝试通过按来收听来自网络的流媒体广播,第一个结果不是广播声音,当我在函数 play_radio 中输入 url 地址时是否有任何错误。当我单击第二个按钮时,我设法收听广播,但不能从网络上的 Windows Media Player 收听广播。

你能帮我定位play_radio函数的错误吗?谢谢。

<html>
<head>
<script type="text/javascript">
    function play_radio(url)
    {
        '<object style="float: right;" classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" width="220" height="50" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701">'+"\n"+   
        '<param name="align" value="center" />'+"\n"+   
        '<param name="url" value="'+url+'" />'+"\n"+   
        '<param name="src" value="'+url+'" /><embed style="float: right;" type="application/x-mplayer2" width="220" height="50" src="'+url+'" url="'+url+'" align="center"></embed></object>'  
    }
</script>
</head>  

<body>
<table style="margin-left: auto; margin-right: auto;" border="1" cellspacing="1" cellpadding="10" align="center">
<tbody>
<tr>
<td><input type="button" value="radio 1" onclick="play_radio('http://www.elshinta.com/v2003a/elsh_streaming.asx')" /></td>
<td><input onclick="window.location.href='http://www.elshinta.com/v2003a/elsh_streaming.asx'" type="BUTTON" value="radio 2" /></td>
</tr>
</tbody>
</table>

</body>
</html>

I tried to listen to streaming radio from the web by pressing the first result is not a radio voice, is there any error when I enter the url address to the function play_radio. When I click the second button, I managed to listen to the radio but not from windows media player on the web.

Can you help me locate the errors of the function play_radio? Thanks.

<html>
<head>
<script type="text/javascript">
    function play_radio(url)
    {
        '<object style="float: right;" classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" width="220" height="50" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701">'+"\n"+   
        '<param name="align" value="center" />'+"\n"+   
        '<param name="url" value="'+url+'" />'+"\n"+   
        '<param name="src" value="'+url+'" /><embed style="float: right;" type="application/x-mplayer2" width="220" height="50" src="'+url+'" url="'+url+'" align="center"></embed></object>'  
    }
</script>
</head>  

<body>
<table style="margin-left: auto; margin-right: auto;" border="1" cellspacing="1" cellpadding="10" align="center">
<tbody>
<tr>
<td><input type="button" value="radio 1" onclick="play_radio('http://www.elshinta.com/v2003a/elsh_streaming.asx')" /></td>
<td><input onclick="window.location.href='http://www.elshinta.com/v2003a/elsh_streaming.asx'" type="BUTTON" value="radio 2" /></td>
</tr>
</tbody>
</table>

</body>
</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼前雾蒙蒙 2024-12-09 12:52:28

您需要使其输出代码,玩家/对象是否会按预期工作,我不知道,但这是代码中的主要问题,因此您需要添加 document.write 或任何其他方式来输出该代码:

<script type="text/javascript">
    function play_radio(url)
    {
        document.write('<object style="float: right;" classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" width="220" height="50" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701">'+"\n"+   
        '<param name="align" value="center" />'+"\n"+   
        '<param name="url" value="'+url+'" />'+"\n"+   
        '<param name="src" value="'+url+'" /><embed style="float: right;" type="application/x-mplayer2" width="220" height="50" src="'+url+'" url="'+url+'" align="center"></embed></object>');
    }
</script>

You need to make it output the code, whether the player/object would work as expected, I don't know, but that's the main issue in your code, so you need add document.write or any other way to output that code:

<script type="text/javascript">
    function play_radio(url)
    {
        document.write('<object style="float: right;" classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" width="220" height="50" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701">'+"\n"+   
        '<param name="align" value="center" />'+"\n"+   
        '<param name="url" value="'+url+'" />'+"\n"+   
        '<param name="src" value="'+url+'" /><embed style="float: right;" type="application/x-mplayer2" width="220" height="50" src="'+url+'" url="'+url+'" align="center"></embed></object>');
    }
</script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文