• Flowplayer

     

     

    Flowplayer is an Open Source video player for the web. Embed the video streams into your web pages. User will get rich media experience by viewing video streams from your site. Player could be extended with Flash plug-ins, JavaScript plug-ins or Streaming plug-ins. Give a new look and feel to the player by extending it.

    It could play the video irrespective of location. The video could be stored in any CDN network like Akamai, Amazon Cloudfront or even local web server. It has built-in slow motion and fast forward support. Social sharing is an important need for almost all web sites. Its viral plug-in helps to spread the videos to most popular social media.

    It has ability to detect bandwidth speed and adjust the bit-rate transferred. It supports MPG, WMV, MOV and AVI formats.

     

    http://flowplayer.org/

    http://flowplayer.org/plugins/streaming/rtmp.html

     

    http://code.google.com/p/flowplayer-plugins/source/checkout

    svn checkout http://flowplayer-plugins.googlecode.com/svn/ flowplayer-plugins-read-only

     

     

  • Play Flash based on HTML path in Red5

    For each flash file,  setup a HTML file with the same name as the flash file, except for the extension.

    The HTML pass the file name to SWF, and SWF play the video.

     

    http://commondatastorage.googleapis.com/red5.zhenglei.net/PlayStreamByPath.7z

     

  • Passing Variables from HTML to Flash in Adobe CS4

    Suppose we need to pass the currnet URL from HTML to Flash:

     

    1.   Add the following  ActionScript into FLA:

    # #  myVIDEO is the parameter from HTML,  and we display it on screen

    var my_fmt = new TextFormat();
    my_fmt.color = 0xFF0000;
    my_fmt.underline = true;
    this.createTextField(“myTxt”, 1, 320, 10, 200, 20);
    myTxt.autoSize = “left”;
    myTxt.setTextFormat(my_fmt);

    if (myVIDEO == undefined) {
    myTxt.text = “Keynote_1.flv”;
    } else {
    myTxt.text = myVIDEO;
    }

     

    2.  Generate the SWF and HTML from FLA

     

     

    3. Modify the generated HTML to add myVIDEO parameter,

       3.1 ==> Add the following line in the  AC_FL_RunContent block:

           ‘flashvars’,”,

     

       3.2 ==> Add the handle of flashvars in function AC_GetArgs, as following:

         case “flashvars”:
            ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = “myVIDEO=”+window.location;
            break;

      // Here myVIDEO the variable in AS2, and window.location is the variable in JavaScript indicating the current URL of HTML page

  • How To Get URL Parts in JavaScript

     

    This JavaScript Tutorial article explains the Location object, and how to retrieve the URL from it in several parts, including how to parse, split, and rebuild URLs.

    This JavaScript tutorial article concentrates on:

    • Obtaining the URL from the window.location object
    • Changing the current location with window.location.href and window.location.reload
    • Splitting and rebuilding URLs with Array and String splitting functions

    The first step is understanding the JavaScript Location object.

    The Location Object

    This is a JavaScript class that is used to store URLs. It comes with properties that represent each part of the URL, and can be updated by changing the href property. The key properties that this article deals with are:

    • location.href : the full URL
    • location.protocol, location.host & location.pathname : the parts of the URL

    In addition there are various methods that

    • location.reload
    • location.replace

    These shall be discussed with reference to the window.location object.

    The window.location Object

    The window.location object is the specific object that stores the URL of the currently loaded page. If a JavaScript function changes the window.location.href property, then the page should reload with the new location.

    However, this may not always be the case, and so the location.reload and location.replace methods have also been provided in the Location object. These were introduced in JavaScript 1.2, and give a little more control over the way that browsing history and current page location URLs are handled. In some cases it may not be enough to set the window.location.href, and so calling window.location.reload will force the page to be refreshed.

    The window.location.replace method is used to overwrite the history entry in the browser, for the current page

    Splitting and Rebuilding URLs

    The URL is stored as the following parts:

    protocol://host/pathname

    Each part can be accessed using the appropriate property of the Location object:

    • location.protocol : for web pages, the value http
    • location.host : for this site www.suite101.com
    • location.pathname : the path to a page i.e. mypages/page1.html

    It is important to note that:

    • The protocol is store without the : or // that make up the whole URL
    • The host will contain a port, where appropriate
    • the pathname does not contain the leading /

    So, to rebuild a URL based on the above information, code such as the following can be used:

    newURL = window.location.protocol + “//” + window.location.host + “/” + window.location.pathname;

    This makes it very easy to create inline links that are context sensitive, and that refer pages that should exist on the server. For example, a site might have a tag page that collects all content that has the tag marketing associated with it. If the word marketing were to appear in a block of text, then JavaScript could be used to pre-process that block of text, and add a URL based on the current URL, but containing the reference to the marketing tag page.

    One final note is that the pathname will be a / separated string, which can be split into an array of strings using the following code:

    pathArray = window.location.pathname.split( ‘/’ );

    Using this approach, it is easy to rebuild URLs, as each component will be contained in one array element. Again, however, it is necessary to put the / back:

    newPathname = “”;
    for ( i = 0; i pathArray.length; i++ ) {
    newPathname += “/”;
    newPathname += pathArray[i];
    }

    The JavaScript Split List or String article contains more details about using arrays and strings in this way.

    Original URL:
  • Passing parameter from HTML to Flash in Adobe CS4

    Suppoe we need pass the video name from HTML to Flash.

    1.   Add the following  ActionScript into FLA:

    # Display the video in screen

    var my_fmt = new TextFormat();
    my_fmt.color = 0xFF0000;
    my_fmt.underline = true;
    this.createTextField(“myTxt”, 1, 320, 10, 200, 20);
    myTxt.autoSize = “left”;
    myTxt.setTextFormat(my_fmt);

    #  myVIDEO is the parameter from HTML
    if (myVIDEO == undefined) {
    myTxt.text = “Keynote_1.flv”;
    } else {
    myTxt.text = myVIDEO;
    }

    // create basic netConnection object
    var nc:NetConnection = new NetConnection();

    // connect to the local Red5 server
    nc.connect(“rtmp://192.168.127.127/oflaDemo”);

    // create the netStream object and pass the netConnection object in the constructor
    var ns:NetStream = new NetStream(nc);

    // attach the netStream object to the video object
    videoContainer.attachVideo(ns);

    // Play the video
    ns.play(myTxt.text);

     

     

    2.  Generate the SWF and HTML from FLA

     

     

    3. Modify the generated HTML to add myVIDEO parameter,

       Three parts to be modified in HTML:

     

       A)  Add the following line in the  AC_FL_RunContent block:

           ‘FlashVars’,’myVIDEO=Keynote_2.flv’,

     

      B)  Add the following line in the  Object block:

          <param name=”FlashVars” value=”myVIDEO=Keynote_2.flv” />

     

      C)  Add the following into the embed scr block:

         FlashVars=”myVIDEO=Keynote_2.flv”

     

    http://commondatastorage.googleapis.com/red5.zhenglei.net/Pass_Variable_From_Html_To_Flash.7z

     

  • setup red5 on ubuntu 10.10

    sudo apt-get update

    sudo apt-get upgrade

    sudo apt-get install sun-java6-jdk

    sudo apt-get install sun-java6-jre

    sudo apt-get install ant

    sudo apt-get install subversion

    sudo apt-get install ivy

    cd /usr/share

    sudo svn export  http://red5.googlecode.com/svn/java/server/trunk/

    sudo mv trunk red5

    sudo chown lzheng -R red5

    sudo chgrp lzheng -R red5

    cd red5

    ant clean

    ant dist

     

    #  Install oflaDemo:

     

     

    # Method 1:    Install from snapshots

    wget http://red5.googlecode.com/svn/snapshots/oflaDemo-r3989-java6.war

    mkdir oflaDemo && cd oflaDemo && unzip  ../oflaDemo-r3989-java6.war && cd ..

    sudo mv oflaDemo  /usr/share/red5/dist/webapps/

     

     

    # Method 2:    Install from dev trunk

    # Download

    svn export http://red5.googlecode.com/svn/java/example/trunk/oflaDemo/

     

    # Setup build property

    echo red5.root=/usr/share/red5/dist > ~/build.properties

    #echo build.optimize=true >> ~/build.properties

    # echo debug.status=false >> ~/build.properties

     

    cd oflaDemo

    ant clean

    ant

    # Result:   dist/oflaDemo.war

    mkdir oflaDemo && cd oflaDemo && unzip  ../dist/oflaDemo.war && cd ..

    sudo mv oflaDemo  /usr/share/red5/dist/webapps/

     

     

     

     

  • VPS ubuntu 10.10 config (9) *** PPTP VPN***

    # Install

    sudo apt-get update

    sudo apt-get upgrade

    sudo apt-get install pptpd

     

    #Config DNS

    sudo nano /etc/ppp/pptpd-options,  and enter the following:

      ms-dns 8.8.8.8

      ms-dsn 8.8.4.4

     

    #Config Password:

    sudo nano /etc/ppp/chap-secrets

        acount [TAB] pptpd [TAB] password [TAB] IP addresses

     

    # Config IP

    sudo nano /etc/pptpd.conf,   and enter the following:

    localip 10.168.10.1  
    remoteip 10.168.10.10-20



    # Config IP forward and IP Nat

    net.ipv4.ip_forward=1
    sudo iptables -t nat -A POSTROUTING -s 10.168.10.0/24 -o eth0 -j MASQUERADE

  • VPS ubuntu 10.10 config (8) *** OpenVPN***

    sudo apt-get update

    sudo apt-get upgrade

    sudo apt-get install openvpn

     

    #Generage certification and key

    cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0   ~/

    cd ~/2.0

    source vars
    ./clean-all
    ./build-ca
    ./build-key-server <servername>
    ./build-key <clientname>
    ./build-dh

     

    # add extra key

    source vars
    ./build-key-server <servername>
    or
    ./build-key <clientname>

     

    # Config OpenVPN listen on port 443, and share port 443 with SSH

     

    Example of config file:

    example_vps_etc.7z

     

    Reference:

    http://forum.ubuntu.org.cn/viewtopic.php?p=532825

     

     

     

  • Enable UPnP in Router

    UPnP service must be enabled in Router.

     

    For DD-WRT based router, it is located at NAT/QoS