1 |
dpavlin |
809 |
package Frey::Web::Flowplayer; |
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 |
|
|
|
14 |
dpavlin |
814 |
has flv => ( |
15 |
dpavlin |
809 |
is => 'rw', |
16 |
|
|
isa => 'Str', |
17 |
|
|
required => 1, |
18 |
dpavlin |
814 |
default => 'var/flv/strix-2005-2008-codeswarm.flv', |
19 |
dpavlin |
809 |
); |
20 |
|
|
|
21 |
dpavlin |
814 |
has flowplayer_js => ( |
22 |
|
|
is => 'rw', |
23 |
|
|
isa => 'Str', |
24 |
|
|
required => 1, |
25 |
|
|
default => 'http://static.flowplayer.org/js/flowplayer-3.0.1.min.js', |
26 |
|
|
); |
27 |
|
|
|
28 |
|
|
has flowplayer_swf => ( |
29 |
|
|
is => 'rw', |
30 |
|
|
isa => 'Str', |
31 |
|
|
required => 1, |
32 |
|
|
default => 'http://static.flowplayer.org/swf/flowplayer-3.0.1.swf', |
33 |
|
|
); |
34 |
|
|
|
35 |
dpavlin |
809 |
sub as_markup { |
36 |
|
|
my ($self) = @_; |
37 |
|
|
|
38 |
dpavlin |
814 |
my $flv = $self->flv; |
39 |
|
|
die "can't find $flv" unless -e $flv; |
40 |
dpavlin |
809 |
|
41 |
dpavlin |
814 |
$flv = "http://localhost:3000/$flv"; |
42 |
|
|
|
43 |
|
|
$self->add_js( $self->flowplayer_js ); |
44 |
|
|
my $swf = $self->flowplayer_swf; |
45 |
|
|
|
46 |
dpavlin |
809 |
qq| |
47 |
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
48 |
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
49 |
|
|
|
50 |
|
|
<!-- |
51 |
|
|
Setup player with standard HTML syntax |
52 |
|
|
* movie file is specified in "href" attribute |
53 |
|
|
* player dimensions are defined with CSS |
54 |
|
|
--> |
55 |
|
|
<a |
56 |
dpavlin |
814 |
href="$flv" |
57 |
dpavlin |
809 |
style="display:block;width:425px;height:300px;" |
58 |
|
|
id="player"> |
59 |
|
|
</a> |
60 |
|
|
|
61 |
|
|
<!-- this script block will install Flowplayer inside previous anchor tag --> |
62 |
|
|
<script language="JavaScript"> |
63 |
dpavlin |
814 |
flowplayer("player", "$swf"); |
64 |
dpavlin |
809 |
</script> |
65 |
|
|
|; |
66 |
|
|
|
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
1; |