View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Carl Rosenberg > Video-CPL-0.10 > Video::CPL



Annotate this POD

View/Report Bugs
Module Version: 0.10   Source  


Video::CPL - Create and manipulate Coincident TV Programming Language (CPL) files.


Version 0.10


Video::CPL provides an object-oriented module for creating CPL files. CPL files control interactive video experiences.

A simple example might be displaying a video, e.g. from Youtube, in a player on a webpage.

A more complex example might include images, which the user clicks on to jump to other videos.

In conjunction with it is straightforward to create fully interactive web pages with dynamically created video experiences.

Video::CPL does not create the video file itself; it works with videos on services such as Youtube, or created with tools such as Video::FFmpeg.

A tutorial is available at

Short code sample: create a file using CPL, and then embed a link to the file in your html as shown below.

    use CPL;
    my $ctv = new Video::CPL(videoSource=>""
    $ctv->programEnd(30);   #end after 30 seconds
    print $ctv->print(); #prints out cpl file

    #and then, when writing html:
    print $ctv->embed();  #print out an HTML embed pointing to the temporary file


new(videoSource=>$url,[backgroundHTML=>$url,frameHeight=>$k, frameWidth=>$k,loggingService=>$url,skinButtons=>$url, videoHeight=>$k,videoViewLayout=>$name,videoWidth=>$k, videoX=>$k,videoY=>$k,webViewLayout=>$name, xUniqueID=$string,xVersionCPL=>$string, xWebServiceLog=>$string],[html=>$loc,ref=>$url],[htmldir=>$dir,htmlurl=>$url) or new(initfromctv=$urlORxml);

    Create a new Video::CPL object. There is one videoSource per Video::CPL object.

    A videoSource such as videoSource=>"", must be specified unless initializing from another Video::CPL file. All other parameters are optional; most of them are specified in the CPL language definition available from Additional file placement options are described below.

    initfromctv=>"foo.ctv" . Given a string which is either valid XML or a filename, use it to initialize the Video::CPL object.

    If the Video::CPL object will be output using the <b>xml()</b> method, there is no need to specify a location for it. It is convenient to specify a location where the Video::CPL XML can be accessed, if multiple Video::CPL objects interact, or if the <b>embed</b> or <b>print</b> methods will be used. 

    For automatic creation of a Video::CPL file, the location of a directory where the file can be created, along with the matching URL to reach that location, must be provided. An example would be <b>htmldir="/var/www/tmp"</b> and <b>htmlref=>"" </b>


    Returns the URL which will recreate this URL. This will be a file or a reference to this script.

    Used when creating the media parameter for the CTV player, which requires a full URL.


    Returns the URL fragment (e.g. foo/goo.ctv) which will access this file from the current directory. If given
    a parameter of another Video::CPL object, will return a URL fragment which is valid in that objects context.


    Accessor routine to set or read xVersionCPL.


    Accessor routine to set or read videoSource. 


    Accessor routine to set or read xWebServiceLoc.


    Accessor routine to set or read loggingService.


    Accessor routine to set or read skinButtons. These are optional, and used to form the control bar.


    Accessor routine to set or read backgroundHTML.


    Accessor routine to set or read videoWidth (the width of the video image within the overall CPL layout).


    Accessor routine to set or read videoHeight (the height of the video image).


    Accessor routine to set or read frameWidth (the width of the entire CPL frame).


    Accessor routine to set or read frameHeight (the height of the entire CPL frame).


    Accessor routine to set or read videoX.


    Accessor routine to set or read videoY.


    Accessor routine to set or read videoViewLayout.


    Accessor routine to set or read webViewLayout.


    Accessor routine to set or read youtubeID.


    Accessor routine to set or read xUniqueID.


    Accessor routine to set or read xProgLevelDir.


    Accessor routine for the video field, which contains an array of three different video sources which can be used.
    Returns an array, or undef if it has not been set.
    Takes an array of 3 urls.
    There is no way to set an individual URL with this accessor; read and then write to set one.


    Accessor routine to get or set the first element of the video array.


    Accessor routine to get or set the second element of the video array.


    Accessor routine to get or set the third element of the video array.


    Create a targetList with one element.



    Returns a name of the form "basedddddddd" which is not used by any other cue point or annotation in this CPL object.


     Adds the created cue to the CPL object. This is not needed if reading the cue points from the video file itself, e.g. with a local .flv file.


    Create a new Cue point with the given parameters, and set the parent to this CPL object.

story(text=>"some text",pic=>"foo.jpg")

     Shorthand to create a Video::CPL::Story object.


    Create a new layout and install it in this CPL. Pass the parameters on to Video::CPL::Layout::new.

layouts() return all layouts for the current Video::CPL as an array


    Return the layout with the given name.


    Return an array with all of the Annotation based Story objects in this CPL.


     Returns the k-th cuePoint Cue object. Note that a normally created CPL object will always create a cue point a the beginning, easily obtained with firstcue(), below.


    Returns all Cue objects.


     Returns the 4th webPoint object. 




     Returns the first cuePoint Cue object.


add() Adds a cue point to the end of the cue point list. The parent of the cue point should either not be set, or be correctly set. Cue points may only have one parent, and can therefore not be used in multiple CPL objects.

webPoints() return all webPoints for the current Video::CPL as an array





    Create and add a new webPoint object.

    Target can be created with something like Video::CPL::Cue->new("Lost A");

    Story is currently just an anonymous hash. It may become an object in a future release.


    Create and add a new goto object.

    Target can be created with something like Video::CPL::Cue->new("Lost A");


    Create and add a new regular object.


    Create and add a new regular object.


    Return the first cue with the given name.


    Return the first cuePoint with the given name.


    Return the first webPoint with the given name.


    Return the cuePt with the given time, or undef.


    Return the first annotation with the given name.




    Create an annotation and add it to the object.

adecoration([annotation parameters])

agoto([annotation parameters])

    adecoration,agoto,ajavascript, and areturnend are shorthand notations to create an annotation and add it
    to the current Video::CPL object, setting the parent correctly. Generally they are recommended if the annotation
    will be used more than once.

    $anno = $cpl->agoto(balloonText=>"go somewhere",x=>10,y=>10,target=>$somecue);

    For a single-use annotation, Annotation::goto may be more convenient.

    $cpl->regular(time=>10)->goto(balloontext=>"go somewhere",x=>10,y=>10);

    This would create a Cue and add an annotation in one statement.

    The annotation parameters are used with normal Annotation constructor; therefore Story parameters such as
    picLoc will cause a Story to be automatically generated. 

ajavascript([annotation paramters])


     my $anno = $cpl->areturnend(balloonText=>"Return please",x=>10,y=>10);



    Add the XML to output this object to the existing XML::Writer object xo. Creation and printing is done outside this routine.


    Return the xml format of the current CPL object. This is normally called from print, but can
    be called directly.


    Print out the current xml in the automatically created temporary file within the web-viewable file hiearchy. Use before calling embed.


    Return the html code used to embed a CPL screen within an html file. 

    The height and width parameters are optional, and may be specified as percent or pixels. If not specified, height will be set to 392 pixels and width to 680 pixels.

    CPL parameters that can be specified:
       height: Height in pixels or percent. Defaults to frameHeight else videoHeight else 680 pixels.
       width: Width in pixels or percent. Defaults to frameWidth else videoWidth else 415 pixels.
       player:  a URL that reaches the desired Flash player. If not specified, will default to a player
           at Coincident TV. This will not be able to access images etc. from a different server unless
           there is a file "crossdomain.xml" at the top level of that server. This file should look like

           <?xml version="1.0"?>
           <!DOCTYPE cross-domain-policy SYSTEM "">
           <allow-access-from domain="*" />
           <site-control permitted-cross-domain-policies="all"/>

       media: the URL of the media CTV. If a partial URL, it will be relative to the player.
       mergedstyle: if true, include the media as a CGI parameter to the player. This is the norm when using the full CPL experience.

    Additional Adobe parameters:
        align:  defaults to "middle".
        play:   defaults to "true".
        quality: defaults to "autohigh".
        allowfullscreen: defaults to "true".
        allowScriptAccess: defaults to "always". In this mode, a webPoint reached from "embed"-ed player
            will overwrite the window.
        type:   defaults to "application/x-shockwave-flash".
        pluginspage: defaults to "http://www.adobecom/go/getflashplayer".
        bgcolor: Hex value,defaults to "#869ca7".


     This is a function, and not a method. Typically it is called before creating a CPL object


    Return true if this URL appears to be a Youtube video.


Carl Rosenberg, <perl at>


Please report any bugs to Coincident TV.


You can find documentation for this module with the perldoc command.

    perldoc CPL


This is actually just a straightforward interface to the work done by the rest of the Coincident team.


Copyright 2010 Coincident TV

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

syntax highlighting: