GU直播-简易直播站

性能指标:

  • 支持统计观众个数
  • 支持在线聊天
  • 支持多个房间推流[RTMP流]
  • 支持流鉴权
  • 支持直播流播放

一些想说的:

之所以会写这个东西,仅仅是为了满足我的小愿望[自己做一个直播站试试],这个直播站从功能以及框架上都非常的羸弱,不足以应对复杂场景,仅仅是做着玩,所以有兴趣的朋友可以下下来玩玩,但不建议应用至生产环境之中。这次的下载站代码会放到Github,并且会在这个文章中附上Nginx(带RTMP模块)的下载链接,以及我的Nginx的配置。

安装:

1.下载Nginx-RTMP windows版

[理论上是可以自己编译的,但win版真的超级难编译]

链接: https://github.com/xaccc/nginx-rtmp-win32

2.修改conf/nginx.conf

worker_processes 1;
daemon off;
master_process off;</code>

error_log logs/error.log info;

events {
worker_connections 1024;
}

rtmp {
server {
listen 1935;//本配置文件是使用1935作为直播服务器的端口

application live {
live on;
notify_method POST;
publish_notify on;
on_publish http://localhost:8080/rtmp/index.php?publish;//网站域名在服务器上使用时也要修改成对外的域名
on_publish_done http://localhost:8080/rtmp/index.php?publish&amp;done;
on_play http://localhost:8080/rtmp/index.php?publish&amp;play;
on_play_done http://localhost:8080/rtmp/index.php?publish&amp;play_done;
}
}
}

http {
include mime.types;
default_type application/octet-stream;
server {
listen 8080;
location / {
root D:/phpstudy/PHPTutorial/WWW;//把这个路径改成你的网站的根目录
index index.html index.htm index.php l.php;
autoindex off;
}
location ~ \.php(.*)$ {
root D:/phpstudy/PHPTutorial/WWW;//把这个路径改成你的网站的根目录
fastcgi_pass 127.0.0.1:9000;//Nginx使用php脚本要单独启用php来监听
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
}

[不过TX云会屏蔽1935端口,所以使用时要自己修改一下]

3.启用Nginx服务器nginx.exe -c conf/nginx.conf

4.启用php服务器php-cgi -b 127.0.0.1:9000 -c php.ini

5.导入SQL到MYSQL中

6.修改config.php

date_default_timezone_set('Asia/Shanghai');
define("DBIP","localhost");//数据库IP
define("DBPORT","3306");//数据库端口
define("DBUSERNAME","root");//数据库用户名
define("DBPASSWORD","root");//数据库密码
define("DBNAME","rmtp");//数据库名
define('SYSTEM_VER','1.0.0');//系统版本号
define('SYSTEM_NAME',"GU直播");//系统名称
define('SYSTEM_ROOT','D:\phpstudy\PHPTutorial\WWW\rtmp\\');//系统网站根目录
define('SUPPORT_URL', 'https://103.249.111.182');
define('SYSTEM_NO_ERROR', false );//是否开启DEBUG模式
define('AUTH_STATE', true );//是否开启注册
define('RTMP_URL', "rtmp://localhost:1935/live/" );//RTMP链接

7.安装完成!

预览图:

登录页面
登录页面
房间信息
房间信息-推流状态自动识别
直播房间
直播房间

Github链接:

https://github.com/7gugu/gu-rtmp

Lebu-乐步H5计步系统

本项目是基于H5 API开发的健身类网页应用

可改造后使其成为”微信小程序”

Github地址:https://github.com/7gugu/lebu

功能:
1.记录用户运动里程
2.记录用户运动消耗卡路里
3.记录用户运动配速
4.生成配速图
5.统计运动趋势
6.管理用户信息

预览:

计步页面

 

历史记录页面
个人信息页面