Olof Johansson > WWW-SVT-Play-0.12 > WWW::SVT::Play::Video

Download:
WWW-SVT-Play-0.12.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.12   Source  

NAME ^

WWW::SVT::Play::Video, extract information about videos on SVT Play

SYNOPSIS ^

 use WWW::SVT::Play::Video;

 my $uri = 'http://www.svtplay.se/video/1014238/del-8';
 my $svtp = WWW::SVT::Play::Video->new($uri);
 say $svtp->title;

 if ($svtp->has_hls) {
         say $svtp->stream(protocol => 'HLS')->url;
 }

DESCRIPTION ^

CONSTRUCTOR ^

WWW::SVT::Play::Video->new($uri)

Construct a WWW::SVT::Play::Video object by passing the URL to the video you're interested in. A second argument consisting of a hashref of options is reserved for future use.

url

 $svtp->url

Returns the URL to the video's web page after it has been, postprocessed somewhat.

stream

 $svtp->stream( protocol => 'HLS' )
 $svtp->stream( internal => 'ios' )
 $svtp->stream( protocol => 'RTMP', bitrate => '1400')

 my $url = $svtp->stream( protocol => 'HLS' )->url
     if $svtp->has_hls;

Returns the stream object matching the given requirement (or undef if video does not have a matching stream). Takes either SVT Play internal playerType name (named parameter: internal), or the protocol name (named parameter: protocol).

Currently supported protocols: HLS, HDS and RTMP. If extracting RTMP, an optional bitrate parameter can be supplied. If this isn't supplied, a hash of bitrate url pairs is returned.

RTMP is deprecated and no longer in use by SVT Play. Support for this may be dropped in the future.

title

Returns a human readable title for the video.

$svtp->filename($type)

Returns a filename suggestion for the video. If you give the optional type argument, you also get a file extension.

$svtp->rtmp_bitrates

In list context, returns a list of available RTMP stream bitrates for the video. In scalar context, the highest available bitrate is returned.

Note: Currently, we only support listing bitrates for RTMP streams, since they are given to us directly in the JSON blob.

$svtp->format($bitrate)

Returns a "guess" of what the format is, by trying to extract a file extension from the stream URL. Of course, the format depends on what bitrate you want, so you have to supply that.

$svtp->subtitles

In list context, returns a list of URLs to subtitles. In scalar context, returns the first URL in that list. If there are no subtitles available for this video, returns an empty list (in list context) or undef (in scalar context).

$svtp->duration

Returns the length of the video in seconds.

$svtp->has_hls

$svtp->has_hds

$svtp->has_rtmp

$svtp->has_http

COPYRIGHT ^

Copyright (c) 2012, 2013 - Olof Johansson <olof@cpan.org>

All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: