2023-12-09 17:46:53 -05:00
NIP-71
2023-12-07 20:09:08 -05:00
======
Video Events
---------------
`draft` `optional`
2023-12-12 13:56:28 -05:00
This specification defines video events representing a dedicated post of externally hosted content. These video events are _parameterized replaceable_ and deletable per [NIP-09 ](09.md ).
2023-12-07 20:09:08 -05:00
2023-12-09 12:55:25 -05:00
Unlike a `kind 1` event with a video attached, Video Events are meant to contain all additional metadata concerning the subject media and to be surfaced in video-specific clients rather than general micro-blogging clients. The thought is for events of this kind to be referenced in a Netflix, YouTube, or TikTok like nostr client where the video itself is at the center of the experience.
2023-12-07 20:09:08 -05:00
## Video Events
2023-12-08 09:06:14 -05:00
There are two types of video events represented by different kinds: horizontal and vertical video events. This is meant to allow clients to cater to each as the viewing experience for horizontal (landscape) videos is often different than that of vertical (portrait) videos (Stories, Reels, Shorts, etc).
2023-12-07 20:09:08 -05:00
#### Format
2023-12-08 09:06:14 -05:00
The format uses a parameterized replaceable event kind `34235` for horizontal videos and `34236` for vertical videos.
2023-12-07 20:09:08 -05:00
2023-12-12 13:56:28 -05:00
The `.content` of these events is a summary or description on the video content.
2023-12-07 20:09:08 -05:00
The list of tags are as follows:
* `d` (required) universally unique identifier (UUID). Generated by the client creating the video event.
2023-12-12 13:56:28 -05:00
* `url` (required) the url to the video file
* `m` a string indicating the data type of the file. The [MIME types ](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types ) format must be used, and they should be lowercase.
2023-12-07 20:09:08 -05:00
* `title` (required) title of the video
2023-12-12 13:56:28 -05:00
* `"published_at"` , for the timestamp in unix seconds (stringified) of the first time the video was published
* `x` containing the SHA-256 hexencoded string of the file.
* `size` (optional) size of file in bytes
* `dim` (optional) size of file in pixels in the form `<width>x<height>`
* `duration` (optional) video duration in seconds
* `magnet` (optional) URI to magnet file
* `i` (optional) torrent infohash
2023-12-07 20:09:08 -05:00
* `text-track` (optional, repeated) link to WebVTT file for video, type of supplementary information (captions/subtitles/chapters/metadata), optional language code
2023-12-09 12:55:25 -05:00
* `thumb` (optional) url of thumbnail with same aspect ratio
2023-12-12 13:56:28 -05:00
* `image` (optional) url of preview image with same dimensions
2023-12-07 20:09:08 -05:00
* `content-warning` (optional) warning about content of NSFW video
2023-12-12 13:56:28 -05:00
* `alt` (optional) description for accessibility
2023-12-12 14:01:51 -05:00
* `segment` (optional, repeated) start timestamp in format `HH:MM:SS.sss` , end timestamp in format `HH:MM:SS.sss` , chapter/segment title, chapter thumbnail-url
2023-12-07 20:09:08 -05:00
* `t` (optional, repeated) hashtag to categorize video
* `p` (optional, repeated) 32-bytes hex pubkey of a participant in the video, optional recommended relay URL
2023-12-09 12:55:25 -05:00
* `r` (optional, repeated) references / links to web pages
2023-12-07 20:09:08 -05:00
```json
{
"id": < 32-bytes lowercase hex-encoded SHA-256 of the the serialized event data > ,
"pubkey": < 32-bytes lowercase hex-encoded public key of the event creator > ,
"created_at": < Unix timestamp in seconds > ,
2023-12-08 09:06:14 -05:00
"kind": 34235 | 34236,
2023-12-12 13:56:28 -05:00
"content": "< summary / description of video > ",
2023-12-07 20:09:08 -05:00
"tags": [
["d", "< UUID > "],
["title", "< title of video > "],
2023-12-08 09:06:14 -05:00
["thumb", "< thumbnail image for video > "],
2023-12-12 13:56:28 -05:00
["published_at", "< unix timestamp > "],
["alt", < description > ],
2023-12-07 20:09:08 -05:00
// Video Data
2023-12-12 13:56:28 -05:00
["url",< string with URI of file > ],
["m", < MIME type > ],
["x",< Hash SHA-256 > ],
["size", < size of file in bytes > ],
["duration", < duration of video in seconds > ],
["dim", < size of file in pixels > ],
["magnet",< magnet URI > ],
["i",< torrent infohash > ],
["text-track", "< encoded `kind 6000` event > ", "< recommended relay urls > "],
2023-12-07 20:09:08 -05:00
["content-warning", "< reason > "],
2023-12-12 14:01:51 -05:00
["segment", < start > , < end > , "< title > ", "< thumbnail URL > "],
2023-12-07 20:09:08 -05:00
// Participants
["p", "< 32-bytes hex of a pubkey > ", "< optional recommended relay URL > "],
["p", "< 32-bytes hex of a pubkey > ", "< optional recommended relay URL > "],
// Hashtags
["t", "< tag > "],
["t", "< tag > "],
// Reference links
["r", "< url > "],
["r", "< url > "]
]
}
```
## Video View
A video event view is a response to a video event to track a user's view or progress viewing the video.
### Format
2023-12-08 09:06:14 -05:00
The format uses a parameterized replaceable event kind `34237` .
2023-12-07 20:09:08 -05:00
The `.content` of these events is optional and could be a free-form note that acts like a bookmark for the user.
The list of tags are as follows:
2023-12-08 09:06:14 -05:00
* `a` (required) reference tag to kind `34235` or `34236` video event being viewed
* `d` (required) same as `a` reference tag value
2023-12-27 09:26:15 -05:00
* `viewed` (optional, repeated) timestamp of the user's start time in seconds, timestamp of the user's end time in seconds
2023-12-07 20:09:08 -05:00
```json
{
"id": < 32-bytes lowercase hex-encoded SHA-256 of the the serialized event data > ,
"pubkey": < 32-bytes lowercase hex-encoded public key of the event creator > ,
"created_at": < Unix timestamp in seconds > ,
2023-12-08 09:06:14 -05:00
"kind": 34237,
2023-12-07 20:09:08 -05:00
"content": "< note > ",
"tags": [
2023-12-08 09:06:14 -05:00
["a", "< 34235 | 34236 > :< video event author pubkey > :< d-identifier of video event > ", "< optional relay url > "],
2023-12-29 15:15:42 -05:00
["e", "< event-id " , " < relay-url > "]
2023-12-08 09:06:14 -05:00
["d", "< 34235 | 34236 > :< video event author pubkey > :< d-identifier of video event > "],
["viewed", < start > , < end > ],
2023-12-07 20:09:08 -05:00
]
}
```