line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::LinkEmbedder::Link::Video; |
2
|
1
|
|
|
1
|
|
465
|
use Mojo::Base 'Mojolicious::Plugin::LinkEmbedder::Link'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
sub to_embed { |
5
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
6
|
0
|
|
|
|
|
|
my $url = $self->url; |
7
|
0
|
0
|
|
|
|
|
my $type = $url->path =~ /\.(\w+)$/ ? $1 : 'unknown'; |
8
|
0
|
|
|
|
|
|
my %args = @_; |
9
|
0
|
|
|
|
|
|
my @extra; |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
0
|
|
|
|
$type = $self->_types->type($type) || "unknown/$type"; |
12
|
0
|
|
0
|
|
|
|
$args{height} ||= $self->DEFAULT_VIDEO_HEIGHT; |
13
|
0
|
|
0
|
|
|
|
$args{width} ||= $self->DEFAULT_VIDEO_WIDTH; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
local $" = ' '; |
16
|
0
|
0
|
|
|
|
|
push @extra, 'autoplay' if $args{autoplay}; |
17
|
0
|
0
|
|
|
|
|
unshift @extra, '' if @extra; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
return $self->tag( |
20
|
|
|
|
|
|
|
video => width => $args{width}, |
21
|
|
|
|
|
|
|
height => $args{height}, |
22
|
|
|
|
|
|
|
class => 'link-embedder', |
23
|
|
|
|
|
|
|
@extra, |
24
|
|
|
|
|
|
|
preload => 'metadata', |
25
|
|
|
|
|
|
|
controls => undef, |
26
|
|
|
|
|
|
|
sub { |
27
|
0
|
|
|
0
|
|
|
return join('', |
28
|
|
|
|
|
|
|
$self->tag(source => src => $url, type => $type), |
29
|
|
|
|
|
|
|
$self->tag(p => class => 'alert', 'Your browser does not support the video tag.')); |
30
|
|
|
|
|
|
|
} |
31
|
0
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=encoding utf8 |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Mojolicious::Plugin::LinkEmbedder::Link::Video - Video URL |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 DESCRIPTION |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
This class inherit from L. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 METHODS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 to_embed |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
TODO. (It returns a video tag for now) |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 AUTHOR |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Jan Henning Thorsen - C |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |