File Coverage

lib/HTML/Object/DOM/TextTrackCue.pm
Criterion Covered Total %
statement 19 28 67.8
branch 0 2 0.0
condition n/a
subroutine 7 13 53.8
pod 6 6 100.0
total 32 49 65.3


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## HTML Object - ~/lib/HTML/Object/DOM/TextTrackCue.pm
3             ## Version v0.2.0
4             ## Copyright(c) 2021 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2021/12/27
7             ## Modified 2022/09/18
8             ## All rights reserved
9             ##
10             ##
11             ## This program is free software; you can redistribute it and/or modify it
12             ## under the same terms as Perl itself.
13             ##----------------------------------------------------------------------------
14             package HTML::Object::DOM::TextTrackCue;
15             BEGIN
16             {
17 1     1   1051 use strict;
  1         14  
  1         33  
18 1     1   5 use warnings;
  1         15  
  1         37  
19 1     1   7 use parent qw( Module::Generic );
  1         14  
  1         4  
20 1     1   62 use vars qw( $VERSION );
  1         4  
  1         57  
21 1     1   17 our $VERSION = 'v0.2.0';
22             };
23              
24 1     1   5 use strict;
  1         2  
  1         46  
25 1     1   5 use warnings;
  1         2  
  1         260  
26              
27             sub init
28             {
29 0     0 1   my $self = shift( @_ );
30 0           $self->{_init_strict_use_sub} = 1;
31 0 0         $self->SUPER::init( @_ ) || return( $self->pass_error );
32 0           return( $self );
33             }
34              
35             # Note: property
36 0     0 1   sub endTime : lvalue { return( shift->_set_get_number( 'endtime', @_ ) ); }
37              
38             # Note: property
39 0     0 1   sub id : lvalue { return( shift->_set_get_scalar_as_object( 'id', @_ ) ); }
40              
41             # Note: property
42 0     0 1   sub pauseOnExit : lvalue { return( shift->_set_get_boolean( 'pauseonexit', @_ ) ); }
43              
44             # Note: property
45 0     0 1   sub startTime : lvalue { return( shift->_set_get_number( 'starttime', @_ ) ); }
46              
47             # Note: property
48 0     0 1   sub track : lvalue { return( shift->_set_get_object_without_init( 'track', 'HTML::Object::DOM::TextTrack', @_ ) ); }
49              
50             1;
51             # NOTE: POD
52             __END__
53              
54             =encoding utf-8
55              
56             =head1 NAME
57              
58             HTML::Object::DOM::TextTrackCue - HTML Object DOM TextTrack Cue Class
59              
60             =head1 SYNOPSIS
61              
62             use HTML::Object::DOM::TextTrackCue;
63             my $this = HTML::Object::DOM::TextTrackCue->new ||
64             die( HTML::Object::DOM::TextTrackCue->error, "\n" );
65              
66             my $video = $doc->getElementById('myVideo');
67             var $caption = $video->addTextTrack('caption');
68             $caption->addCue(new HTML::Object::DOM::VTTCue("Test text", 01.000, 04.000,"","","",true));
69              
70             =head1 VERSION
71              
72             v0.2.0
73              
74             =head1 DESCRIPTION
75              
76             This class is inherited by L<HTML::Object::DOM::VTTCue> and is part of a collection with L<HTML::Object::DOM::TextTrackCueList>
77              
78             C<TextTrackCue> is an abstract class which is used as the basis for the various derived cue types, such as L<VTTCue|HTML::Object::DOM::VTTCue>; you will instead work with those derived types. These cues represent strings of text presented for some duration of time during the performance of a L<TextTrack|HTML::Object::DOM::TextTrack>. The cue includes the start time (the time at which the text will be displayed) and the end time (the time at which it will be removed from the display), as well as other information.
79              
80             =head1 PROPERTIES
81              
82             =head2 endTime
83              
84             A double that represents the video time that the cue will stop being displayed, in seconds.
85              
86             Example:
87              
88             my $video = $doc->querySelector('video');
89             my $track = $video->addTextTrack("captions", "Captions", "en");
90             $track->mode = 'showing';
91              
92             my $cue1 = HTML::Object::DOM::VTTCue->new(0.1, 0.9, 'Hildy!');
93             say( $cue1->endTime ); # 0.9
94             $track->addCue( $cue1 );
95              
96             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/endTime>
97              
98             =head2 id
99              
100             A string that identifies the cue.
101              
102             Example:
103              
104             my $video = $doc->querySelector('video');
105             my $track = $video->addTextTrack("captions", "Captions", "en");
106             $track->mode = 'showing';
107              
108             my $cue1 = HTML::Object::DOM::VTTCue->new(0, 0.9, 'Hildy!');
109             $cue1->id = 'first';
110             $track->addCue( $cue1 );
111              
112             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/id>
113              
114             =head2 pauseOnExit
115              
116             A boolean for whether the video will pause when this cue stops being displayed.
117              
118             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/pauseOnExit>
119              
120             =head2 startTime
121              
122             A double that represents the video time that the cue will start being displayed, in seconds.
123              
124             Example:
125              
126             my $video = $doc->querySelector('video');
127             my $track = $video->addTextTrack("captions", "Captions", "en");
128             $track->mode = 'showing';
129              
130             my $cue1 = HTML::Object::DOM::VTTCue->new(0.1, 0.9, 'Hildy!');
131             say( $cue1->startTime ); # 0.1
132             $track->addCue( $cue1 );
133              
134             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/startTime>
135              
136             =head2 track
137              
138             The L<TextTrack|HTML::Object::DOM::TextTrack> that this cue belongs to, or C<undef> if it does not belong to any.
139              
140             Example:
141              
142             my $video = $doc->querySelector('video');
143             my $captiontrack = $video->addTextTrack("captions", "Captions", "en");
144             $captiontrack->mode = 'showing';
145              
146             my $cue1 = HTML::Object::DOM::VTTCue->new(0, 0.9, 'Hildy!');
147             $captiontrack->addCue( $cue1 );
148             say( $cue1->track ); # a TextTrack object.
149              
150             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/track>
151              
152             =head1 AUTHOR
153              
154             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
155              
156             =head1 SEE ALSO
157              
158             L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue>
159              
160             =head1 COPYRIGHT & LICENSE
161              
162             Copyright(c) 2021 DEGUEST Pte. Ltd.
163              
164             All rights reserved
165              
166             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
167              
168             =cut