{"id":13602709,"url":"https://github.com/zsxsoft/danmu-client","last_synced_at":"2026-01-05T00:02:56.538Z","repository":{"id":28303218,"uuid":"31815868","full_name":"zsxsoft/danmu-client","owner":"zsxsoft","description":"A cross-platforms danmaku client that supports transparency which based on canvas + WebSocket. 多用跨平台透明弹幕客户端，支持图文弹幕，基于canvas + WebSocket。","archived":false,"fork":false,"pushed_at":"2017-08-20T06:31:09.000Z","size":439,"stargazers_count":149,"open_issues_count":0,"forks_count":30,"subscribers_count":13,"default_branch":"electron","last_synced_at":"2024-11-07T05:39:51.366Z","etag":null,"topics":["danmaku","danmu","electron","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zsxsoft.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-07T15:16:18.000Z","updated_at":"2024-10-25T10:29:12.000Z","dependencies_parsed_at":"2022-08-28T20:52:18.184Z","dependency_job_id":null,"html_url":"https://github.com/zsxsoft/danmu-client","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsxsoft%2Fdanmu-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsxsoft%2Fdanmu-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsxsoft%2Fdanmu-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsxsoft%2Fdanmu-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zsxsoft","download_url":"https://codeload.github.com/zsxsoft/danmu-client/tar.gz/refs/heads/electron","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248368190,"owners_count":21092314,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["danmaku","danmu","electron","javascript"],"created_at":"2024-08-01T18:01:35.009Z","updated_at":"2026-01-05T00:02:51.246Z","avatar_url":"https://github.com/zsxsoft.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Misc"],"sub_categories":["Misc / Desktop"],"readme":"danmu-client\n==========\n[![Github All Releases](https://img.shields.io/github/downloads/zsxsoft/danmu-client/total.svg)](https://github.com/zsxsoft/danmu-client/releases)\n[![David deps](https://david-dm.org/zsxsoft/danmu-client.svg)](https://david-dm.org/zsxsoft/danmu-client)\n\n这是一个独立的弹幕客户端，其服务端项目见[danmu-server](https://github.com/zsxsoft/danmu-server)。屏幕截图见[Release](https://github.com/zsxsoft/danmu-client/releases)。\n\n**欲使用此项目，服务端需要使用对应的版本。[已发布的客户端](https://github.com/zsxsoft/danmu-client/releases)均已写明对应的服务端版本号，开发分支内的客户端版本仅对应开发分支的服务端。**\n\n## 功能特色\n- 以``WebSocket``作为通讯协议，用``Canvas``作为弹幕的画布；\n- 可在桌面任何位置显示弹幕，可与其他程序（如PowerPoint、视频播放器等）共同工作；\n- 窗口置于最前，完全透明可穿透，能与其他程序正常交互；\n- 提供紧急清空弹幕池、停止接收弹幕等功能，可删除单条弹幕；\n- 支持图片弹幕。\n\n### 适用场景\n- 数十人至千人集会（如学校活动、电影放映会）的实时互动\n- 大型活动实时公告信息显示\n- 欲在桌面显示实时吐槽\n\n## 最低系统要求\n\nWindows 7 / macOS 10.9 (x64) / Ubuntu 12.04 / Fedora 21 / Debian 8\n\n## 使用预编译版本\n\n1. 打开[Release](https://github.com/zsxsoft/danmu-client/releases)下载已经编译好的程序包并解压到某目录。\n2. 双击目录下的``danmu-client``，启动成功。\n\n## 从源码启动\n\n1. 下载并安装[Nodejs](https://nodejs.org)，并检查[node-gyp](https://github.com/nodejs/node-gyp)的依赖环境。\n2. ``npm install``\n3. ``npm start``\n\n## 打包发布\n\n``npm run build``\n\n## 配置说明\n根目录``config.js``下有配置，以下是说明\n\n    socket: {\n        url: \"弹幕服务器开启的IP与端口（如使用反代，需要确认反代支持WebSocket连接）\",\n        password: \"弹幕服务器连接密码\",\n        room: \"选择连接弹幕服务器的某间房间\",\n        heartbeat: 心跳包发送间隔\n    },\n    display: {\n        comment: {\n            animationStyle: \"默认弹幕样式（支持scroll、reversescroll、staticdown、staticup）\",\n            fontStyle: \"默认字体样式\",\n            fontColor: \"默认颜色\",\n            lifeTime: 每条弹幕的基本存活时间,\n            height: 每条弹幕占据高度\n        }, \n        image: 图片弹幕开关\n    }, \n    image: {\n        regex: 图片判断正则，勿动\n        whitelist: [\n            \"图片弹幕允许加载的网络图片白名单。\", \n            \"不支持通配符，必须一条一条手动添加。\", \n            \"请确认图片可以正常被打开。\"\n        ], \n        preload: 网络图片是否预读缓存\n    }\n\n## 图片弹幕\n打开图片弹幕开关后，弹幕内含相关内容的将被解析为图片。图片必须可以正常打开，调用代码如：``[IMG WIDTH=24]danmu-24.png[/IMG]``。格式：``[IMG WIDTH=图片宽度]图片地址（支持HTTP）[/IMG]``\n\n为了保证安全与稳定，图片弹幕有防火墙机制。只有在弹幕程序目录及子目录下存在的图片才可被加载。引用网络图片，必须手动修改``config.js``添加白名单规则。如果被过滤，则程序不会有任何提示，该弹幕也不会被显示。\n\n## 自定义弹幕\n需要在服务器打开相应开关后，才允许使用自定义弹幕功能。自定义弹幕必须返回一个函数（或类），继承自``lib/danmu/sprite.js``中的``Sprite``，并需要实现``updateLifeTime``方法和``draw``方法，有``alive``属性。__为确保效率，自定义弹幕未加入错误捕捉。一旦函数出错，则弹幕系统停止接受新弹幕。__\n示例代码如下（生成一个颜色随机、在屏幕上晃来晃去的玩意）：\n\n### 最新版示例代码 \n```javascript\nreturn (() =\u003e {\n    'use strict';\n    const Sprite = require('./lib/danmu/sprite');\n    let canvasWidth = 0;\n    let canvasHeight = 0;\n    class Comment extends Sprite {\n        constructor(param) {\n            super(param.id, param.x, param.y, param.width, param.height, param.speed, param.lifeTime);\n            this.text = param.text || \"\"; //文字内容\n            this.lifeTime = param.lifeTime || config.display.comment.lifeTime;\n            this.font = param.font || config.display.comment.fontStyle;\n        }\n        draw(canvasContext) {\n            if (canvasWidth === 0) canvasWidth = canvasContext.canvas.width;\n            if (canvasHeight === 0) canvasHeight = canvasContext.canvas.height;\n            canvasContext.fillStyle = `rgb(${parseInt(Math.random() * 255)}, ${parseInt(Math.random() * 255)}, ${parseInt(Math.random() * 255)})`;\n            canvasContext.font = this.font;\n            canvasContext.fillText(this.text, parseInt(Math.random() * canvasWidth), parseInt(Math.random() * canvasHeight));\n        }\n        updateLifeTime() {\n            this.lifeTime--; //每刷新一帧，存活时间-1\n            this.alive = (this.lifeTime \u003e= 0);\n        };\n    }\n    return Comment;\n})();\n\n```\n\n\n## 开源协议\nThe MIT License (MIT)\n\n\n## 博文\n[弹幕服务器及搭配之透明弹幕客户端研究结题报告](https://blog.zsxsoft.com/post/15)\n\n[弹幕服务器及搭配之透明弹幕客户端研究中期报告](https://blog.zsxsoft.com/post/14)\n\n[弹幕服务器及搭配之透明弹幕客户端研究开题报告](https://blog.zsxsoft.com/post/13)\n\n## 开发者\nzsx - https://www.zsxsoft.com / 博客 - https://blog.zsxsoft.com\n\n## 感谢\n[DDPlayer](https://github.com/dpy1123/ddplayer) by dpy1123\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzsxsoft%2Fdanmu-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzsxsoft%2Fdanmu-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzsxsoft%2Fdanmu-client/lists"}