1 |
package Frey::Web::FLVPlayer; |
2 |
use Moose; |
3 |
|
4 |
=head1 SEE ALSO |
5 |
|
6 |
L<http://flowplayer.org/documentation/installation.html> |
7 |
|
8 |
=cut |
9 |
|
10 |
extends 'Frey'; |
11 |
with 'Frey::Web'; |
12 |
#with 'Frey::Storage'; |
13 |
with 'Frey::File::FLV'; |
14 |
|
15 |
has path => ( |
16 |
is => 'rw', |
17 |
isa => 'Str', |
18 |
required => 1, |
19 |
default => 'var/flv/codeswarm.flv', |
20 |
); |
21 |
|
22 |
has flowplayer_js => ( |
23 |
is => 'rw', |
24 |
isa => 'Str', |
25 |
required => 1, |
26 |
default => 'http://static.flowplayer.org/js/flowplayer-3.0.1.min.js', |
27 |
); |
28 |
|
29 |
has flowplayer_swf => ( |
30 |
is => 'rw', |
31 |
isa => 'Str', |
32 |
required => 1, |
33 |
default => 'http://static.flowplayer.org/swf/flowplayer-3.0.1.swf', |
34 |
); |
35 |
|
36 |
sub as_markup { |
37 |
my ($self) = @_; |
38 |
|
39 |
my $path = $self->path; |
40 |
die "can't find $path" unless -e $path; |
41 |
|
42 |
my $url = "http://localhost:3000/$path"; # FIXME |
43 |
|
44 |
$self->add_js( $self->flowplayer_js ); |
45 |
my $swf = $self->flowplayer_swf; |
46 |
|
47 |
my %info = $self->flv_info; |
48 |
warn "# info ", $self->dump( \%info ); |
49 |
|
50 |
my $width = $info{meta_width}; |
51 |
my $height = $info{meta_height}; |
52 |
|
53 |
qq| |
54 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
55 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
56 |
|
57 |
<!-- |
58 |
Setup player with standard HTML syntax |
59 |
* movie file is specified in "href" attribute |
60 |
* player dimensions are defined with CSS |
61 |
--> |
62 |
<a |
63 |
href="$url" |
64 |
style="display:block;width:${width}px;height:${height}px;" |
65 |
id="player"> |
66 |
</a> |
67 |
|
68 |
<!-- this script block will install Flowplayer inside previous anchor tag --> |
69 |
<script language="JavaScript"> |
70 |
flowplayer("player", "$swf"); |
71 |
</script> |
72 |
|; |
73 |
|
74 |
} |
75 |
|
76 |
1; |