# living **Repository Path**: yigecom/living ## Basic Information - **Project Name**: living - **Description**: h5直播 + wesocket弹幕 +srs流媒体服务器 - **Primary Language**: PHP - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 5 - **Created**: 2025-04-18 - **Last Updated**: 2025-04-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # living #### 介绍 直播 - 直播播放 弹幕 #### 软件架构 软件架构说明 - SRS 搭建流媒体服务器 - 前端 barrager + 后端php websocket实现弹幕功能 - RtmpStreamer.js 实现直播推流 - 酷播播放器实现拉流播放直播视频 #### 安装教程 1. 安装srs Linux环境下安装 srs Github地址为地址:https://github.com/ossrs/srs 里面有使用指导,按照安装步骤操作即可 安装完成可用OBS-Studio进行流媒体服务器直播测试,VLC media player进行播放 2. index.html 为直播播放页面 3. media.html为直播页面 4. danmu.php为弹幕 服务端 websocket #### 使用说明 1. 运行srs 命令 srs srs/trunk/objs/srs -c srs/trunk/conf/srs.conf (该命令在安装的路径执行) 2. 执行 php danmu.php (需安装php swoole扩展) 3. 酷播直播组件依赖浏览器的flash,必须开启谷歌浏览器 flash才能看到效果 4. 该项目需要https协议下使用 本人在wampserver环境下实现的,实现wampserver 配置https 证书 1. 下载openssl.exe 在网站 https://slproweb.com/products/Win32OpenSSL.html 下载对应自己操作系统的软件,然后安装 2. cmd下执行命令 结合本机,cmd下切换到 D:\wamp\bin\apache\apache2.4.9\bin,然后依次执行执行 ``` openssl genrsa -aes256 -out private.key 2048 openssl rsa -in private.key -out private.key openssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 -config D:\wamp\bin\apache\apache2.4.9\conf\openssl.cnf ``` 执行命令期间,会让输入密码,或者国家地区一类的 ,按提示输入即可,执行结束后会在 D:\wamp\bin\apache\apache2.4.9\bin 目录下生成 certificate.crt 和 private.key 两个文件,复制这两个文件,然后切换目录到 D:\wamp\bin\apache\apache2.4.9\conf 下,创建key文件夹,放入这两个文件 3. 配置更改 打开apache 配置文件, D:\wamp\bin\apache\apache2.4.9\conf\httpd.conf,修改3项内容,去除默认的 # ``` Include conf/extra/httpd-ssl.conf LoadModule ssl_module modules/mod_ssl.so LoadModule socache_shmcb_module modules/mod_socache_shmcb.so ``` 然后打开配置文件 D:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf ,在原默认配置中做如下修改 ``` ServerAdmin webmaster@dummy-host.example.com DocumentRoot "d:/wamp/www/living/" ServerName test.living.com ErrorLog "logs/dummy-host.test.living.com-error.log" CustomLog "logs/dummy-host.test.living.com-access.log" common SSLEngine on SSLCertificateFile "${SRVROOT}/conf/key/certificate.crt" SSLCertificateKeyFile "${SRVROOT}/conf/key/private.key" ``` 4. 根据实际修改index.html 和media.html 注释todo的配置内容