How to provide restricted access MP3 streaming over the internet

百般思念 提交于 2019-12-06 16:00:15

IP addresses do not uniquely identify users. There are plenty of situations where NAT comes into play, and you can have hundreds of users all behind the same public IP address.

What you need to do is have another method for identifying users. Assuming you don't want to require accounts, you can use a session ID.

Basically, you assign an ID with a cookie to a browser. When the user clicks a link to launch their audio player, the session ID is passed in the URL to the stream. With this method, it doesn't matter if the browser itself or a separate audio player is used to play the stream. It is up to the streaming server to then accept or reject the request.

It is common to accept any new request and disconnect the old when a new stream starts. Icecast doesn't support this sort of thing natively, but it does provide an API of sorts with the admin interface that you can use from your own scripts to get this behavior.

Alternatively, I have written a server called AudioPump that provides similar functionality. It isn't generally available yet, but please contact me at brad@audiopump.co if you're interested.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!