Code Monkey home page Code Monkey logo

serverless-dplayer-php's Introduction

Serverless-DPlayer-PHP

DPlayer Serverless 750×445px.png

这是什么?

使用腾讯云函数(SCF)PHP 7搭建的无服务器Dplayer弹幕后端

MoePlayer/DPlayer-node比有什么不一样吗?

+ ~~使用PHP v7,PHP才是最好的语言!(划掉~~
+ 本项目无需安装服务器、依赖等,可以直接部署
+ 腾讯云函数有一定免费额度,在请求少的情况下成本几乎为零,无需购买VPS
+ 可以设置敏感词,屏蔽广告等
! 无法100%兼容Dplayer,如无法限制最大弹幕数量
- 高并发下性能不明

怎么用啊?

0x0001

首先,你需要有一个腾讯云账号 ->点我注册

0x0002

从最新的Release中下载 Serverless-DPlayer-PHP.zip

在云函数列表新建一个函数 image.png

自定义创建->事件函数->代码部署->本地上传zip包

执行方法为 danmaku.main_handler

image.png

下载一个最新的Release中的layer.zip,新建一个层(名称随意)并上传 image.png

绑定

image.png

0x003

image.png 在触发管理中添加一个API网关的触发器

0x0004

配置config.php中的信息,完成! Dplayer后端地址形如 https://service-henghenghengaaa-114514.gz.apigw.tencentcs.com/release/danmaku/

花多少钱啊?

截至目前,腾讯云每月免费额度信息如下:

内存(MB) 免费时长(秒)
128 3,200,000
256 1,600,000
512 800,000
1024 400,000
1536 266,667
3072 133,333

我可以用我自己的服务器吗?

目前仅支持SCF,请见谅

还有问题?

加入Telegram群或提交Issue

serverless-dplayer-php's People

Contributors

tennousuathena avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

serverless-dplayer-php's Issues

如何填写DPlayer配置中的弹幕选项

目前,腾讯云的云函数界面有较大变化,与文档有较大出入。
申请好之后得到的地址填入DPlayer中的 danmaku.api 中,token中填写config中的token,请问其余项是否需要更改?目前按照DPlayer的文档填写其余项、修改api及token不能成功。

可否出一个 danmaku: {.....} 的范例?

无法正确创建弹幕文件

按照readme设置之后无法成功发送弹幕

F12 开发者控制台显示
{"code":0,"msg":"Danmaku not completed:","0":{"token":"tokendem0","id":"nv-danmutest-35934","author":"guest","time":0,"text":"ggjgbm","color":13959417,"type":1}}
而我查阅了SCF后台的触发日志,发现对于创建弹幕文件的请求为403,如以下的pastebin所示:
https://pastebin.com/XBiaTebq

我猜测是腾讯云对于私有读写的权限更改所造成的http标头不正确导致的,有什么解决办法吗?在此感谢。

进程在完成请求前退出

{
"errorCode": 1,
"errorMessage": "Process exited before completing request",
"requestId": "xxx",
"statusCode": 439
}

跨域问题

Access to XMLHttpRequest at 'https://xxx.tencentcs.com/release/danmaku/v3/' from origin 'https://xxx.net' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
api.js:12 Error: Network Error
at e.exports (createError.js:4)
at XMLHttpRequest.y.onerror (xhr.js:53)
(匿名) @ api.js:12
Promise.catch(异步)
send @ api.js:11
value @ danmaku.js:135
value @ comment.js:112
(匿名) @ comment.js:53
xhr.js:111 POST https://xxx.tencentcs.com/release/danmaku/v3/ net::ERR_FAILED

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.