nips/61.md

49 lines
1.7 KiB
Markdown
Raw Normal View History

2024-04-20 02:35:56 -04:00
NIP-61
======
Danmaku
-------
`draft` `optional`
This NIP defines a new kind of event, `2333`, for danmaku.
2024-04-24 21:44:50 -04:00
Danmaku is a subtitle system in online videos where users post comments synchronized with the video timeline. It's also used in music, podcasts, and other media.
2024-04-20 02:35:56 -04:00
### Format
The format uses a regular event kind `2333`.
The `.content` of these events is the content of the danmaku comment.
The list of tags are as follows:
* `i` (required) universally unique identifier of the video. The format is `<platform (lowercase)>:<identity>` where `<platform>` is the platform of the video and `<identity>` is the unique identifier of the video on that platform. For example, a YouTube video with the identifier `aA-jiiepOrE` would have the identifier `youtube:aA-jiiepOrE`.
* `time` (required) the time of the video when the danmaku comment is sent in seconds.
2024-04-24 00:05:23 -04:00
* `duration` (optional) the duration of the danmaku comment shown in seconds.
* `speed` (optional) the speed of the danmaku comment in pixels per second.
* `color` (optional) the color of the danmaku comment in hexadecimal format.
2024-09-01 02:49:11 -04:00
* `mode` (optional) the display mode of the danmaku comment. The following values are possible:
* `rtl` the danmaku comment scrolls from right to left.
* `top` the danmaku comment is displayed at the top of the screen.
* `bottom` the danmaku comment is displayed at the bottom of the screen.
2024-04-24 00:05:23 -04:00
Any other styling tags are allowed. And, client implementations should ignore any tags they do not understand.
2024-04-20 02:35:56 -04:00
2024-09-01 02:49:11 -04:00
### Example
2024-04-20 02:35:56 -04:00
```jsonc
{
"id": "<...>",
"pubkey": "<...>",
"kind": 2333,
"tags": [
["i", "youtube:aA-jiiepOrE"],
2024-09-01 02:49:11 -04:00
["time", "3.018597"],
["color", "#FFFFFF"],
["mode", "rtl"]
2024-04-20 02:35:56 -04:00
],
"content": "Hello Nostr!",
"sig": "<...>",
"created_at": 1713368851
}
```