pub struct Video {Show 16 fields
pub kind: VideoKind,
pub identifier: Option<String>,
pub content: String,
pub title: String,
pub media: Vec<MediaAttachment>,
pub published_at: Option<Timestamp>,
pub alt: Option<String>,
pub content_warning: Option<String>,
pub duration_seconds: Option<f64>,
pub text_tracks: Vec<TextTrack>,
pub segments: Vec<Segment>,
pub hashtags: Vec<String>,
pub participants: Vec<VideoParticipant>,
pub references: Vec<Url>,
pub origin: Option<VideoOrigin>,
pub extra_tags: Vec<Tag>,
}Expand description
Typed bundle for a NIP-71 video event (any of the four kinds).
Fields§
§kind: VideoKindSemantic kind.
identifier: Option<String>d identifier (required for addressable variants).
content: String.content — summary / description.
title: Stringtitle tag (required).
media: Vec<MediaAttachment>Media variants (at least one imeta tag).
published_at: Option<Timestamp>published_at Unix timestamp.
alt: Option<String>alt accessibility description.
content_warning: Option<String>content-warning reason.
duration_seconds: Option<f64>Top-level duration in seconds (used by the spec’s
addressable example; the same value MAY also ride inside
imeta).
text_tracks: Vec<TextTrack>text-track rows.
segments: Vec<Segment>segment chapters.
t hashtags (lower-cased).
participants: Vec<VideoParticipant>p participants.
references: Vec<Url>r URL references.
origin: Option<VideoOrigin>origin import metadata.
Forward-compatible passthrough for unknown tags.
Implementations§
Source§impl Video
impl Video
Sourcepub fn new(
kind: VideoKind,
title: impl Into<String>,
media: MediaAttachment,
) -> Self
pub fn new( kind: VideoKind, title: impl Into<String>, media: MediaAttachment, ) -> Self
Construct a regular (non-addressable) video.
Sourcepub fn identifier(self, identifier: impl Into<String>) -> Self
pub fn identifier(self, identifier: impl Into<String>) -> Self
Set the d identifier (required for addressable kinds).
Sourcepub fn media(self, media: MediaAttachment) -> Self
pub fn media(self, media: MediaAttachment) -> Self
Append another media variant.
Sourcepub const fn published_at(self, ts: Timestamp) -> Self
pub const fn published_at(self, ts: Timestamp) -> Self
Set Self::published_at.
Sourcepub fn content_warning(self, warning: impl Into<String>) -> Self
pub fn content_warning(self, warning: impl Into<String>) -> Self
Sourcepub const fn duration_seconds(self, secs: f64) -> Self
pub const fn duration_seconds(self, secs: f64) -> Self
Sourcepub fn text_track(self, track: TextTrack) -> Self
pub fn text_track(self, track: TextTrack) -> Self
Append a text track.
Sourcepub fn participant(self, p: VideoParticipant) -> Self
pub fn participant(self, p: VideoParticipant) -> Self
Append a participant.
Sourcepub fn origin(self, origin: VideoOrigin) -> Self
pub fn origin(self, origin: VideoOrigin) -> Self
Set the origin metadata.
Sourcepub fn coordinate(&self, author: PublicKey) -> Option<Coordinate>
pub fn coordinate(&self, author: PublicKey) -> Option<Coordinate>
Build the addressable coordinate. Returns None for
non-addressable kinds.
Sourcepub fn from_event(event: &Event) -> Result<Self, VideoError>
pub fn from_event(event: &Event) -> Result<Self, VideoError>
Parse an NIP-71 event into a typed bundle.
§Errors
VideoError::WrongKindfor any non-NIP-71 kind.VideoError::MissingIdentifieron addressable variants missing adtag.VideoError::MissingTitlewhen notitletag is present.VideoError::MissingMediawhen noimetatags are present (the spec says the primary source of video info isimeta).- Field-specific errors for malformed columns.