HTML::O...::VTTCue(3)
okay so welcome to HTML::O...::VTTCue(3) from User Contributed Perl Documentation β this is the whole page, bestie, and it's giving very much "yes I know Unix and I want you to understand it too" π
β¨ NAME β¨
HTML::Object::DOM::VTTCue β HTML Object DOM VTTCue Class. That's the name, no cap. π
πΈ SYNOPSIS πΈ
Here's the vibe in code, literally exactly:
use HTML::Object::DOM::VTTCue;
my $cue = HTML::Object::DOM::VTTCue->new ||
die( HTML::Object::DOM::VTTCue->error, "\n" );
<video controls src="https://example.org/some/where/media/video.mp4"></video>
my $video = $doc->querySelector('video');
my $track = $video->addTextTrack("captions", "Captions", "en");
$track->mode = 'showing';
$track->addCue( new HTML::Object::DOM::VTTCue( 0, 0.9, 'Hildy!') ) ;
$track->addCue( new HTML::Object::DOM::VTTCue( 1, 1.4, 'How are you?' ) );
$track->addCue( new HTML::Object::DOM::VTTCue( 1.5, 2.9, 'Tell me, is the lord of the universe in?' ) );
$track->addCue( new HTML::Object::DOM::VTTCue( 3, 4.2, 'Yes, he\'s in - in a bad humor' ) );
$track->addCue( new HTML::Object::DOM::VTTCue( 4.3, 6, 'Somebody must\'ve stolen the crown jewels' ) );
say( $track->cues );
β VERSION β
v0.2.0 β that's the version, bestie. β¨
π DESCRIPTION π
This implements a VTTCue object representing a cue which will be presented during the time span given.
The VTTCue interface β part of the Web API for handling WebVTT (text tracks on media presentations) β describes and controls the text track associated with a particular <track> element (HTML::Object::DOM::Element::Track). Lowkey iconic. π¦
π¦ INHERITANCE π¦
Here's the family tree, no cap:
+---------------------------------+ +---------------------------+
| HTML::Object::DOM::TextTrackCue | --> | HTML::Object::DOM::VTTCue |
+---------------------------------+ +---------------------------+
π CONSTRUCTOR π
new
VTTCue takes 3 parameters: startTime, endTime and text. Periodt.
startTimeβ This is a double representing the initial text track cue start time. This is the time, given in seconds and fractions of a second, denoting the beginning of the range of the media data to which this cue applies. For example, if a cue is to be visible from 50 seconds to a one minute, five and a half seconds in the media's playback,startTimewill be50.0β andendTimeis the next parameter, iykyk.endTimeβ This is a double representing the ending time for this text track cue. This is the time at which the cue should stop being presented to the user, given in seconds and fractions thereof. Given the example cue mentioned understartTime, the value ofendTimewould be65.5β andtextis the next parameter up.textβ A string providing the text that will be shown during the time span indicated bystartTimeandendTime.
π PROPERTIES π
align
Returns an enum representing the alignment of all the lines of text within the cue box.
Example:
my $video = $doc->querySelector('video');
my $track = $video->addTextTrack("captions", "Captions", "en");
$track->mode = "showing";
my $cue1 = HTML::Object::DOM::VTTCue->new( 0, 0.9, 'Hildy!' );
$cue1->align = 'start';
say( $cue1->align );
$track->addCue( $cue1 );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/align
endTime
This is a double representing the ending time for this text track cue. This is the time at which the cue should stop being presented to the user, given in seconds and fractions thereof. Given the example cue mentioned under startTime, the value of endTime would be 65.5 β and text is the next property, periodt.
line
Returns the line positioning of the cue. This can be the string auto or a number whose interpretation depends on the value of snapToLines.
Example:
my $video = $doc->querySelector('video');
my $track = $video->addTextTrack("captions", "Captions", "en");
$track->mode = "showing";
my $cue1 = HTML::Object::DOM::VTTCue->new( 0, 0.9, 'Hildy!' );
$cue1->line = '1';
say( $cue1->line );
$track->addCue( $cue1 );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/line
lineAlign
Returns an enum representing the alignment of the line.
Example:
my $video = $doc->querySelector('video');
my $track = $video->addTextTrack("captions", "Captions", "en");
$track->mode = "showing";
my $cue1 = HTML::Object::DOM::VTTCue->new( 0, 0.9, 'Hildy!' );
$cue1->lineAlign = 'center';
say( $cue1->lineAlign );
$track->addCue( $cue1 );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/lineAlign
position
Returns the indentation of the cue within the line. This can be the string auto or a number representing the percentage of the region, or the video size if region is undef.
Example:
my $video = $doc->querySelector('video');
my $track = $video->addTextTrack("captions", "Captions", "en");
$track->mode = "showing";
my $cue1 = HTML::Object::DOM::VTTCue->new( 0, 0.9, 'Hildy!' );
$cue1->position = '2';
say( $cue1->position );
$track->addCue( $cue1 );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/position
positionAlign
Returns an enum representing the alignment of the cue. This is used to determine what the position is anchored to. The default is auto.
Example:
my $video = $doc->querySelector('video');
my $track = $video->addTextTrack("captions", "Captions", "en");
$track->mode = "showing";
my $cue1 = HTML::Object::DOM::VTTCue->new( 0, 0.9, 'Hildy!' );
$cue1->positionAlign = 'line-right';
say( $cue1->positionAlign );
$track->addCue( $cue1 );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/positionAlign
region
A VTTRegion object describing the video's sub-region that the cue will be drawn onto, or undef if none is assigned.
Example:
my $video = $doc->querySelector('video');
my $track = $video->addTextTrack("captions", "Captions", "en");
$track->mode = "showing";
my $cue1 = HTML::Object::DOM::VTTCue->new( 0, 0.9, 'Hildy!' );
say( $cue1->region );
$track->addCue( $cue1 );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/region
size
Returns a double representing the size of the cue, as a percentage of the video size.
Example:
my $video = $doc->querySelector('video');
my $track = $video->addTextTrack("captions", "Captions", "en");
$track->mode = "showing";
my $cue1 = HTML::Object::DOM::VTTCue->new( 0, 0.9, 'Hildy!' );
$cue1->size = 50;
say( $cue1->size );
$track->addCue( $cue1 );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/size
snapToLines
Returns true if the line attribute is an integer number of lines or a percentage of the video size.
Example:
my $video = $doc->querySelector('video');
my $track = $video->addTextTrack("captions", "Captions", "en");
$track->mode = "showing";
my $cue1 = HTML::Object::DOM::VTTCue->new( 0, 0.9, 'Hildy!' );
$cue1->snapToLines = 1; # true
say( $cue1->snapToLines );
$track->addCue( $cue1 );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/snapToLines
startTime
This is a double representing the initial text track cue start time. This is the time, given in seconds and fractions of a second, denoting the beginning of the range of the media data to which this cue applies. For example, if a cue is to be visible from 50 seconds to a one minute, five and a half seconds in the media's playback, startTime will be 50.0 β and endTime is the next property, iykyk.
text
Returns a string with the contents of the cue.
Example:
my $video = $doc->querySelector('video');
my $track = $video->addTextTrack("captions", "Captions", "en");
$track->mode = "showing";
my $cue1 = HTML::Object::DOM::VTTCue->new( 0, 0.9, 'Hildy!' );
$cue1->text = 'new cue value';
say( $cue1->text ) # 'new cue value';
$track->addCue( $cue1 );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/text
vertical
Returns an enum representing the cue writing direction.
Example:
my $video = $doc->querySelector('video');
my $track = $video->addTextTrack("captions", "Captions", "en");
$track->mode = "showing";
my $cue1 = HTML::Object::DOM::VTTCue->new( 0, 0.9, 'Hildy!' );
$cue1->vertical = 'rl';
say( $cue1->vertical );
$track->addCue( $cue1 );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/vertical
π₯ METHODS π₯
Inherits methods from its parent HTML::Object::Element.
getCueAsHTML
Returns the cue text as a HTML::Object::DOM::DocumentFragment.
Example:
my $video = $doc->querySelector('video');
my $track = $video->addTextTrack("captions", "Captions", "en");
$track->mode = "showing";
my $cue1 = HTML::Object::DOM::VTTCue->new( 0, 0.9, 'Hildy!' );
say( $cue1->getCueAsHTML() );
$track->addCue( $cue1 );
See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/getCueAsHTML
π AUTHOR π
Jacques Deguest <jack@deguest.jp> β that's the author, bestie. π«Ά
π SEE ALSO π
- Mozilla documentation:
https://developer.mozilla.org/en-US/docs/Web/API/VTTCue - W3C specifications:
https://www.w3.org/TR/webvtt1/ - Specifications:
https://w3c.github.io/webvtt/#the-vttcue-interface
π COPYRIGHT & LICENSE π
Copyright(c) 2021 DEGUEST Pte. Ltd.
All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's a wrap, bestie! π This page is from perl v5.42.2, dated 2026-02-15, and it's the HTML::O...::VTTCue(3) manpage. Periodt. π
π¦ where this page comes from
- alpine 3.24: perl-html-object-doc 0.6.0-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms