Perl bindings: Difference between revisions

From VideoLAN Wiki
Jump to navigation Jump to search
Created page with "= Perl bindings = '''TODO: this wiki page is work in progress''' == Installation == You need to have libvlc with headers already installed. TODO: install from CPAN ==..."
 
m Simplify layout
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Perl bindings =
'''TODO: this wiki page is work in progress'''
'''TODO: this wiki page is work in progress'''


Line 10: Line 8:


== Usage ==
== Usage ==
<syntaxhighlight lang="perl">
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use VideoLAN::LibVLC;


#!/usr/bin/env perl
unless (@ARGV) {
die "1 argument needed - path to a file.";
use strict;
}
use warnings;
 
use 5.010;
my $inst = VideoLAN::LibVLC::Instance->new;
my $media = VideoLAN::LibVLC::Media->new($inst, $ARGV[0], "path");
use VideoLAN::LibVLC;
my $player = VideoLAN::LibVLC::MediaPlayer->new($media);
 
unless (@ARGV) {
$player->play;
die "1 argument needed - path to a file.";
 
}
sleep 5;
say $player->fullscreen;
my $inst = VideoLAN::LibVLC::Instance->new;
$player->fullscreen(1);
my $media = VideoLAN::LibVLC::Media->new($inst, $ARGV[0], "path");
say $player->fullscreen;
my $player = VideoLAN::LibVLC::MediaPlayer->new($media);
sleep 5;
$player->toggle_fullscreen;
$player->play;
say $player->fullscreen;
sleep 5;
sleep 5;
</syntaxhighlight>
say $player->fullscreen;
$player->fullscreen(1);
say $player->fullscreen;
sleep 5;
$player->toggle_fullscreen;
say $player->fullscreen;
sleep 5;


== Known issues ==
== Known issues ==
Line 42: Line 41:
* Libvlc event handling is not supported currently.
* Libvlc event handling is not supported currently.
* It's unknown whether it works under windows or not, I never tested it there.
* It's unknown whether it works under windows or not, I never tested it there.
[[Category:Bindings]]

Latest revision as of 09:02, 27 March 2019

TODO: this wiki page is work in progress

Installation

You need to have libvlc with headers already installed.

TODO: install from CPAN

Usage

#!/usr/bin/env perl

use strict;
use warnings;
use 5.010;

use VideoLAN::LibVLC;

unless (@ARGV) {
	die "1 argument needed - path to a file.";
}

my $inst = VideoLAN::LibVLC::Instance->new;
my $media = VideoLAN::LibVLC::Media->new($inst, $ARGV[0], "path");
my $player = VideoLAN::LibVLC::MediaPlayer->new($media);

$player->play;

sleep 5;
say $player->fullscreen;
$player->fullscreen(1);
say $player->fullscreen;
sleep 5;
$player->toggle_fullscreen;
say $player->fullscreen;
sleep 5;

Known issues

  • Libvlc event handling is not supported currently.
  • It's unknown whether it works under windows or not, I never tested it there.