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