如何在网站上播放流文件m3u

问题描述 投票:0回答:1

我想在我的网站上集成一个网络播放器来播放我的m3u流媒体文件。

我在github上找到了这个javascript文件并尝试让它运行。很遗憾没有成功。

https://github.com/aitorciki/jquery-playlist

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="jquery.playlist.js"></script>
</head>

<body>
<script type="text/javascript">
    $(document).ready(function() {
        $('audio').playlistParser({
        proxy: 'proxy.php'
        });
    });
</script>

<audio controls src="http://www.stream.com/stream.m3u">
</body>
</html>

proxy.php文件:

$url = file_get_contents($_GET["url"]);
echo $url;

或者是否有完全不同的解决方案?

谢谢

javascript jquery github m3u
1个回答
0
投票

似乎播放列表插件适用于jQuery v3,而不是jQuery v1。在我修改你的代码以使用jQuery v3后,它对我有用

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="jquery.playlist.js"></script>
</head>

<body>
<script type="text/javascript">
    $(document).ready(function() {
        $('audio').playlistParser({
        proxy: 'proxy.php'
        });
    });
</script>

<audio controls src="http://www.stream.com/stream.m3u">
</body>
</html>
© www.soinside.com 2019 - 2024. All rights reserved.