Data stream (e.g. music) using PHP (or another language)

For many years I have been learning how to create music streams from my computer. I saw programs, but nothing useful that I saw is only Windows (I use a Mac).

In the end, I was interested in how threads work. Is it possible to create my own thread, possibly using socket functions in PHP ? Is there a PHP library for this?

+4
source share
2 answers

Take a look at Ampache . This is an open source web file manager. It is implemented with MySQL and PHP. It allows you to view, edit and play audio files over the Internet.

+3
source

In the end, it comes down to the protocol you want to use. Shoutcast IMHO is simple HTTP, so to create your own stream, you simply output the contents of the streams.

To make ogg-based webradio my Sonos system, I created a small transcoding wrapper around sox, which is actually written in PHP, so it may be useful for you to serve as an example.

You will find it here: http://www.gnegg.ch/ogg2mp3/

If after implementing your own streaming protocol - maybe even based on UDP, then I'm afraid PHP may not be the right solution to the problem - at least not as long as it has its own share of problems when used for long processes (which 5.3 may bring some help with its integrated garbage collection)

+1
source

Source: https://habr.com/ru/post/1276552/


All Articles