/[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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/lib/Frey/Web/Flowplayer.pm revision 814 by dpavlin, Thu Dec 11 21:07:52 2008 UTC trunk/lib/Frey/Web/FLVPlayer.pm revision 847 by dpavlin, Mon Dec 15 18:57:04 2008 UTC
# Line 1  Line 1 
1  package Frey::Web::Flowplayer;  package Frey::Web::FLVPlayer;
2  use Moose;  use Moose;
3    
4  =head1 SEE ALSO  =head1 SEE ALSO
5    
6  L<http://flowplayer.org/documentation/installation.html>  L<http://flv-player.net/>
7    
8  =cut  =cut
9    
10  extends 'Frey';  extends 'Frey';
11  with 'Frey::Web';  with 'Frey::Web';
12  #with 'Frey::Storage';  #with 'Frey::Storage';
13    with 'Frey::File::FLV';
14    
15  has flv => (  has title => (
16          is => 'rw',          is => 'rw',
17          isa => 'Str',          isa => 'Str',
         required => 1,  
         default => 'var/flv/strix-2005-2008-codeswarm.flv',  
18  );  );
19    
20  has flowplayer_js => (  has path => (
21          is => 'rw',          is => 'rw',
22          isa => 'Str',          isa => 'Str',
23          required => 1,          required => 1,
24          default => 'http://static.flowplayer.org/js/flowplayer-3.0.1.min.js',          default => 'var/flv/codeswarm.flv',
25  );  );
26    
27  has flowplayer_swf => (  has player_swf => (
28          is => 'rw',          is => 'rw',
29          isa => 'Str',          isa => 'Str',
30          required => 1,          required => 1,
31          default => 'http://static.flowplayer.org/swf/flowplayer-3.0.1.swf',          default => 'http://flv-player.net/medias/player_flv_maxi.swf',
32  );  );
33    
34  sub as_markup {  sub as_markup {
35          my ($self) = @_;          my ($self) = @_;
36    
37          my $flv = $self->flv;          my $path = $self->path;
38          die "can't find $flv" unless -e $flv;          die "can't find $path" unless -e $path;
39    
40            my $url = "http://localhost:3000/$path"; # FIXME
41    
42            my $swf = $self->player_swf;
43    
44            my %info = $self->flv_info;
45            warn "# info ", $self->dump( \%info );
46    
47            my $width  = $info{meta_width};
48            my $height = $info{meta_height};
49    
50            my @var = ( "flv=$url" );
51    
52            my $srt = $path;
53            $srt =~ s{\.flv}{.srt};
54            if ( -e $srt ) {
55                    push @var, "srt=1";
56            }
57    
58          $flv = "http://localhost:3000/$flv";          push @var, 'title=' . $self->title if $self->title;
59    
60          $self->add_js( $self->flowplayer_js );          my $FlashVars = join('&amp;', @var);
         my $swf = $self->flowplayer_swf;  
61    
62          qq|          qq|
63  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"                  <object type="application/x-shockwave-flash" data="$swf" width="$width" height="$height">
64      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">                  <param name="movie" value="$swf" />
65                    <param name="FlashVars" value="$FlashVars" />
66  <!--                    </object>
    Setup player with standard HTML syntax  
       * movie file is specified in "href" attribute    
       * player dimensions are defined with CSS    
 -->  
 <a    
     href="$flv"  
     style="display:block;width:425px;height:300px;"    
     id="player">  
 </a>  
   
 <!-- this script block will install Flowplayer inside previous anchor tag -->  
 <script language="JavaScript">  
     flowplayer("player", "$swf");  
 </script>  
67          |;          |;
68    
69  }  }

Legend:
Removed from v.814  
changed lines
  Added in v.847

  ViewVC Help
Powered by ViewVC 1.1.26