| 1 | ##---------------------------------------------------------------------------- | ||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/VideoTrack.pm | ||
| 3 | ## Version v0.2.0 | ||
| 4 | ## Copyright(c) 2021 DEGUEST Pte. Ltd. | ||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||
| 6 | ## Created 2021/12/28 | ||
| 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::VideoTrack; | ||
| 15 | BEGIN | ||
| 16 | { | ||
| 17 | use strict; | ||
| 18 | use warnings; | ||
| 19 | warnings::register_categories( 'HTML::Object' ); | ||
| 20 | use parent qw( HTML::Object::EventTarget ); | ||
| 21 | use vars qw( $VERSION ); | ||
| 22 | use HTML::Object::Exception; | ||
| 23 | our $VERSION = 'v0.2.0'; | ||
| 24 | }; | ||
| 25 | |||
| 26 | use strict; | ||
| 27 | use warnings; | ||
| 28 | |||
| 29 | sub init | ||
| 30 | { | ||
| 31 | my $self = shift( @_ ); | ||
| 32 | return( $self->error({ | ||
| 33 | message => sprintf( "At least 1 argument required, but only %d passed", scalar( @_ ) ), | ||
| 34 | class => 'HML::Object::TypeError', | ||
| 35 | }) ) if( scalar( @_ ) < 3 ); | ||
| 36 | my $kind = shift( @_ ); | ||
| 37 | my $label = shift( @_ ); | ||
| 38 | my $lang = shift( @_ ); | ||
| 39 | return( $self->error({ | ||
| 40 | message => "kind argument provided is not a string", | ||
| 41 | class => 'HML::Object::TypeError', | ||
| 42 | }) ) if( $kind !~ /^\w+$/ ); | ||
| 43 | # If set, this should be the same as the id in HTML::Object::DOM::Element::Track | ||
| 44 | $self->{id} = undef; | ||
| 45 | $self->{kind} = $kind; | ||
| 46 | $self->{label} = $label; | ||
| 47 | $self->{language} = $lang; | ||
| 48 | $self->{_init_strict_use_sub} = 1; | ||
| 49 | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||
| 50 | return( $self ); | ||
| 51 | } | ||
| 52 | |||
| 53 | # Note: property id inherited | ||
| 54 | |||
| 55 | # Note: property kind inherited | ||
| 56 | |||
| 57 | # Note: property label inherited | ||
| 58 | |||
| 59 | # Note: property language inherited | ||
| 60 | |||
| 61 | # Note: property | ||
| 62 | sub selected : lvalue { return( shift->_set_get_boolean({ | ||
| 63 | field => 'selected', | ||
| 64 | callbacks => | ||
| 65 | { | ||
| 66 | add => sub | ||
| 67 | { | ||
| 68 | my $me = shift( @_ ); | ||
| 69 | my $parent; | ||
| 70 | if( ( $parent = $me->parent ) && ( my $coderef = $parent->can( '_update_selected' ) ) ) | ||
| 71 | { | ||
| 72 | $coderef->( $parent, $me ); | ||
| 73 | } | ||
| 74 | } | ||
| 75 | } | ||
| 76 | }, @_ ) ); } | ||
| 77 | |||
| 78 | # Note: property | ||
| 79 | sub sourceBuffer { return; } | ||
| 80 | |||
| 81 | 1; | ||
| 82 | # NOTE: POD | ||
| 83 | __END__ |