Skip to content

niconicomments ​

Comment rendering library that is somewhat compatible with the official Nico Nico Douga player

Install ​

NodeJS:

sh
npm i @xpadev-net/niconicomments

Web:

html
<script src="https://cdn.jsdelivr.net/npm/@xpadev-net/niconicomments@0.5.0/dist/bundle.js"></script>

Example ​

Using HTMLCanvasElement ​

js
const canvas = document.getElementById("canvas");
const video = document.getElementById("video");
const req = await fetch("sample.json");
const res = await req.json();
const niconiComments = new NiconiComments(canvas, res);
setInterval(() => niconiComments.drawCanvas(Math.floor(video.currentTime * 100)), 10);

Using CanvasRenderer ​

js
const canvas = document.getElementById("canvas");
const video = document.getElementById("video");
const req = await fetch("sample.json");
const res = await req.json();
const renderer = new NiconiComments.internal.renderer.CanvasRenderer(canvas);
const niconiComments = new NiconiComments(renderer, res);
setInterval(() => niconiComments.drawCanvas(Math.floor(video.currentTime * 100)), 10);

For users who use this library for domestic use in Japan ​

This library may infringe on Dwango's patents depending on how it is used

Please carefully review the following applicable patents and case law before using this library with caution.