Home> PHP Framework> Swoole> body text

Can swoole do live broadcast?

Release: 2019-12-12 11:32:46
Original
4035 people have browsed it

Can swoole do live broadcast?

swoole can do live streaming.

The specific steps for swoole to do live broadcast: (laptop with camera)

1. Swoole creates 2 monitors and a WebSocket monitoring service (for video streaming). A local [Unix Socket file descriptor] (used for accepting and forwarding the video stream transcoded by ffmpeg to the WebSocket client.)

2. The browser uses the jsmpeg project to connect to the WebSocket service provided by Swoole to obtain Video streaming.

3. Use ffmpeg to transcode the live video stream into mpeg video stream format and send it to the local Swoole listening [Unix Socket] file descriptor, such as: $serv->addlistener("/var/run/ myserv.sock", 0, SWOOLE_UNIX_STREAM); File descriptor: /var/run/myserv.sock

4. The onReceive event of the file descriptor monitored by Swoole will receive the ffmpeg transcoded video stream. Send the video stream to the client connected to the WebSocket service through Swoole's WebSocket method push.

Recommended learning:swoole video tutorial

The above is the detailed content of Can swoole do live broadcast?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!