Docker 部署 KPlayer 实现B站24小说无人直播间,循环播放电影解说视频
服务器,国内、国外服务器均可
服务器需安装 docker、docker-compose 环境,没安装的可参考文章 - docker、docker-compose 安装
GitHub 地址:https://github.com/bytelang/kplayer-go ( https://github.com/bytelang/kplayer-go )
Docker 镜像地址:https://hub.docker.com/r/bytelang/kplayer ( https://hub.docker.com/r/bytelang/kplayer )
KPlayer 文档:https://docs.kplayer.net ( https://docs.kplayer.net )
B 站、斗鱼、虎牙等直播平台账号
# 创建目录
# 上传视频
# 创建文件/root/docker_data/kplayer 文件夹下面新建 KPlayer 配置 config.json
#
{ "version": "2.0.0", "resource": { # 容器中存放视频的文件夹,可根据 docker-compose.yml 中的配置进行修改 "lists": ["/video"], # 过滤允许播放的文件类型,如mp4、flv等 "extensions": [] }, "output": { "lists": [ { # 推流地址 "path": "rtmp://live-push.bilivideo.com/live-bvc/?streamname=live_******_******&key=**************&schedule=rtmp&pflag=1" } ], "reconnect_internal": 5 }, "play": { "fill_strategy": "ratio", "skip_invalid_resource": true, # 启用推流编码缓存,会生成缓存,命中缓存节约CPU资源 "cache_on": true, # 播放模式,目前为按顺序且循环播放,其他参数请参考KPlayer文档 "play_model": "loop" }}
version: "3.3"
services:
kplayer:
container_name: kplayer
volumes:
- "/root/docker_data/kplayer/video:/video"
- "/root/docker_data/kplayer/config.json:/kplayer/config.json"
- "/root/docker_data/kplayer/cache:/kplayer/cache"
restart: always
image: "bytelang/kplayer"
运行 yml 文件
docker-compose.yml up -d
License:
CC BY 4.0