blib/lib/HTML/Object/DOM/TextTrackCue.pm untested

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