說明
Dplayer播放器就不過多介紹了干旁,不知道的可以查看官方項(xiàng)目地址:點(diǎn)擊查看聪姿,算是目前國內(nèi)比較火的視頻播放器躲庄,貌似很多人喜歡用彈幕功能饰恕,而官方提供的彈幕api已經(jīng)掛了,所以我們想使用的話友浸,要么使用公開的api接口计螺,要么自建一個(gè)夯尽,這里就說下使用騰訊云自建教程。
1.購買騰訊云輕量應(yīng)用服務(wù)器登馒,這里推薦參加騰訊云輕量應(yīng)用服務(wù)器無憂活動(dòng) 活動(dòng)地址:https://cloud.tencent.com/act/lighthouse
這里直接使用官方基于Node.js的彈幕項(xiàng)目搭建匙握,項(xiàng)目地址:點(diǎn)擊查看,由于搭建默認(rèn)使用Docker陈轿,而有些服務(wù)器本身有相關(guān)環(huán)境圈纺,或者不喜歡Docker的,就不是很方便麦射,所以這里列舉下CentOS蛾娶、Debian、Ubuntu手動(dòng)搭建教程
搭建
提示:不想搭建的潜秋,可直接使用現(xiàn)成的彈幕api接口地址:https://dplayer.moerats.com
以下教程適用于Debian 8蛔琅、9、10系統(tǒng)峻呛,CentOS和Ubuntu教程后面也會(huì)談到罗售。
1辜窑、安裝NodeJS
curl -sL https://deb.nodesource.com/setup_10.x | bash -apt install -y git nodejs
2、安裝Mongodb
#Debian 8系統(tǒng)wget -qO - https://www.mongodb.org/static/pgp/server-4.0.asc | apt-key add -echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/4.0 main" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list
apt update -y
apt -y install mongodb-org
systemctl start mongod
systemctl enable mongod#Debian 9系統(tǒng)wget -qO - https://www.mongodb.org/static/pgp/server-4.0.asc | apt-key add -echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list
apt update -y
apt -y install mongodb-org
systemctl start mongod
systemctl enable mongod#Debian 10系統(tǒng)wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add -echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | tee /etc/apt/sources.list.d/mongodb-org-4.2.list
apt update -y
apt -y install mongodb-org
systemctl start mongod
systemctl enable mongod
3寨躁、安裝Redis
apt install redis-server -y
4穆碎、安裝彈幕服務(wù)器
#拉取源碼git clone https://github.com/MoePlayer/DPlayer-node.gitcd DPlayer-node
npm i
npm i -g pm2
pm2 start index.js --name danmuapi
CentOS安裝方法
提示:以下教程適用于CentOS 7、8系統(tǒng)
安裝NodeJS
curl -sL https://rpm.nodesource.com/setup_10.x | bash -yum install nodejs git -y
安裝Mongodb
#將下面命令一起復(fù)制進(jìn)SSH客戶端運(yùn)行cat <<EOF > /etc/yum.repos.d/mongodb.repo[mongodb-org-4.0]name=MongoDB Repositorybaseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.0/x86_64/gpgcheck=1enabled=1gpgkey=https://www.mongodb.org/static/pgp/server-4.0.ascEOF#安裝mongodbyum -y install mongodb-org
systemctl start mongod
systemctl enable mongod
安裝Redis
#CentOS 7系統(tǒng)yum install epel-release -y
yum install redis -y
systemctl start redis
systemctl enable redis#CentOS 8系統(tǒng)yum install redis -y
systemctl start redis
systemctl enable redis
安裝彈幕服務(wù)器
#拉取源碼git clone https://github.com/MoePlayer/DPlayer-node.gitcd DPlayer-node
npm i
npm i -g pm2
pm2 start index.js --name danmuapi
Ubuntu安裝方法
提示:以下教程適用于Ubuntu 16.04职恳、18.04所禀、20.04系統(tǒng)
安裝NodeJS
curl -sL https://deb.nodesource.com/setup_10.x | bash -apt install -y git nodejs
安裝Mongodb
#Ubuntu 16.04系統(tǒng)wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
apt update -y
apt install -y mongodb-org
systemctl start mongod
systemctl enable mongod#Ubuntu 18.04系統(tǒng)wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
apt update -y
apt install -y mongodb-org
systemctl start mongod
systemctl enable mongod#Ubuntu 20.04系統(tǒng)wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
apt update -y
apt install -y mongodb-org
systemctl start mongod
systemctl enable mongod
安裝Redis
apt install redis-server -y
安裝彈幕服務(wù)器
#拉取源碼git clone https://github.com/MoePlayer/DPlayer-node.gitcd DPlayer-node
npm i
npm i -g pm2
pm2 start index.js --name danmuapi
此時(shí)api地址為http://ip:1207,最后請使用域名反代下該地址放钦,不然可能會(huì)影響使用色徘。
至于彈幕使用的話,很多插件都會(huì)內(nèi)置彈幕設(shè)置接口操禀,或者自行看Dplayer官方文檔:點(diǎn)擊查看贺氓。