/[Frey]/trunk/lib/Frey/Web/FLVPlayer.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/lib/Frey/Web/FLVPlayer.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 844 - (hide annotations)
Mon Dec 15 18:32:49 2008 UTC (15 years, 4 months ago) by dpavlin
Original Path: trunk/lib/Frey/Web/Flowplayer.pm
File size: 1526 byte(s)
Frey::Class::Refactor::Modify Frey::Web::Flowplayer -> Frey::Web::FLVPlayer
1 dpavlin 844 package Frey::Web::FLVPlayer;
2 dpavlin 809 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 dpavlin 823 with 'Frey::File::FLV';
14 dpavlin 809
15 dpavlin 823 has path => (
16 dpavlin 809 is => 'rw',
17     isa => 'Str',
18     required => 1,
19 dpavlin 825 default => 'var/flv/codeswarm.flv',
20 dpavlin 809 );
21    
22 dpavlin 814 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 dpavlin 809 sub as_markup {
37     my ($self) = @_;
38    
39 dpavlin 823 my $path = $self->path;
40     die "can't find $path" unless -e $path;
41 dpavlin 809
42 dpavlin 823 my $url = "http://localhost:3000/$path"; # FIXME
43 dpavlin 814
44     $self->add_js( $self->flowplayer_js );
45     my $swf = $self->flowplayer_swf;
46    
47 dpavlin 823 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 dpavlin 809 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 dpavlin 823 href="$url"
64     style="display:block;width:${width}px;height:${height}px;"
65 dpavlin 809 id="player">
66     </a>
67    
68     <!-- this script block will install Flowplayer inside previous anchor tag -->
69     <script language="JavaScript">
70 dpavlin 814 flowplayer("player", "$swf");
71 dpavlin 809 </script>
72     |;
73    
74     }
75    
76     1;

  ViewVC Help
Powered by ViewVC 1.1.26