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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 847 - (show annotations)
Mon Dec 15 18:57:04 2008 UTC (15 years, 4 months ago) by dpavlin
File size: 1188 byte(s)
added title and subtitle auto-detection
1 package Frey::Web::FLVPlayer;
2 use Moose;
3
4 =head1 SEE ALSO
5
6 L<http://flv-player.net/>
7
8 =cut
9
10 extends 'Frey';
11 with 'Frey::Web';
12 #with 'Frey::Storage';
13 with 'Frey::File::FLV';
14
15 has title => (
16 is => 'rw',
17 isa => 'Str',
18 );
19
20 has path => (
21 is => 'rw',
22 isa => 'Str',
23 required => 1,
24 default => 'var/flv/codeswarm.flv',
25 );
26
27 has player_swf => (
28 is => 'rw',
29 isa => 'Str',
30 required => 1,
31 default => 'http://flv-player.net/medias/player_flv_maxi.swf',
32 );
33
34 sub as_markup {
35 my ($self) = @_;
36
37 my $path = $self->path;
38 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 push @var, 'title=' . $self->title if $self->title;
59
60 my $FlashVars = join('&amp;', @var);
61
62 qq|
63 <object type="application/x-shockwave-flash" data="$swf" width="$width" height="$height">
64 <param name="movie" value="$swf" />
65 <param name="FlashVars" value="$FlashVars" />
66 </object>
67 |;
68
69 }
70
71 1;

  ViewVC Help
Powered by ViewVC 1.1.26