Open Source:
http://www.findbestopensource.com/
Free or Open source
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
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
This JavaScript tutorial article concentrates on:
The first step is understanding the JavaScript 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:
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
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/
# 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
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:
Reference:
http://forum.ubuntu.org.cn/viewtopic.php?p=532825
UPnP service must be enabled in Router.
For DD-WRT based router, it is located at NAT/QoS
(1) Enable SSDP Discovery Service
Start -> Setting -> Control Plane -> Administrative Tools-> Service -> SSDP Discovery Service
(2) Add UPnP Windows Component
Start -> Setting -> Control Plane -> Add or Remove Program -> Add/Remove Windows Component -> Network Service -> UPnP User Interface + Internet Gateway Discovery
(3) Enable UPnP in Windows XP Firewall
Start -> Setting -> Control Plane-> Windows Firewall -> Exception -> UPnP Firewall
Refer Link:
http://hi.baidu.com/chenshake/blog/item/ea299f8b398a8ed7fc1f1008.html