1.拉取镜像
docker pull bytelang/kplayer:latest
2.拉取配置文件(在当前目录生成config.json文件)
mkdir -p /root/kplayer
sudo docker run --rm --name kplayer -v $PWD:/config -it bytelang/kplayer:latest cp -p /kplayer/config.json.example /config/config.json
3.安装nginx
docker pull nginx
mkdir -p /root/player/video
chmod -R 777 /root/player/video
docker run -d -p 80:80 -p 443:443 --name=nignx --restart=always -v /root/kplayer/video:/var/www/video nginx:latest
4.default.conf文件配置
location / video {
alias /var/www/video/;
}
5.修改config.json
{
"version": "2.0.0",
"resource": {
"lists": [
"http://*.*.*.*/video/test.mp4"
]
},
"play": {
"play_model": "loop"
},
"output": {
"lists": [
{
"path": "rtmp://live-push.bilivideo.com/live-bvc/?streamname=..."
}
]
}
}
6.运行kplayer
sudo docker run -it --name=kplayer -v /root/kplayer/video:/var/www/video -v $PWD/config.json:/kplayer/config.json -d bytelang/kplayer:latest