Second Physical Communication Laboratory

The live streaming video with parameters controller.

by admin on 1 月.21, 2009, under Showcase

In this showcase, I made the controller for the streaming live Flash. You can change the parameters by the some slider bars.
If you want to know mean the parameters, Please read this page.

showcase_1.swf

If you want to show from the client, You should open here.(There is a streaming live Flash video viewer on this web page.)

<!-- containersnavigatorsTNSimple.mxml -->
width="550" height="300"&gt;
<!-- Accounts view goes here. -->
<![CDATA[
import flash.media.Video;
import flash.media.Camera;
import flash.media.Microphone;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.*;
import mx.events.SliderEvent;
import mx.controls.sliderClasses.Slider;

public var myCamera:Camera;
public var myMic:Microphone;
public var pub_nc:NetConnection;
public var pub_ns:NetStream;
private var streamingURL:String = "rtmp://wdash.iobb.net/oflaDemo";
public function initCamera():void {
publishVideo();
myVid.attachCamera(myCamera);
}
public function publishVideo():void{
myCamera = Camera.getCamera();
myMic = Microphone.getMicrophone();
pub_nc = new NetConnection();
pub_nc.client = new CustomClient();
pub_nc.addEventListener(NetStatusEvent.NET_STATUS,pub_netStatus);
pub_nc.connect(streamingURL);
}
private function pub_netStatus(event:NetStatusEvent):void {
if (event.info.code == "NetConnection.Connect.Success") {
pub_ns = new NetStream(pub_nc);
pub_ns.attachAudio(myMic);
pub_ns.attachCamera(myCamera);
pub_ns.publish("demo","live");
} else{
trace("error");
}
}
private function sliderChange(event:SliderEvent):void {
var currentSlider:Slider=Slider(event.currentTarget);
text1.text=currentSlider.id + " = " + String(currentSlider.value);
if(currentSlider.id == "SSlider"){
}
else if(currentSlider.id == "FSlider"){
myCamera.setMode(320,240,FSlider.value);
}
else if(currentSlider.id == "QSlider"){
myCamera.setQuality(BSlider.value,QSlider.value);
}
else if(currentSlider.id == "BSlider"){
myCamera.setQuality(BSlider.value,QSlider.value);
}
else{
}
}
public function handleClick():void {
SSlider.value = 1;
FSlider.value = 15;
QSlider.value = 0;
BSlider.value = 16384;
myCamera.setMode(320,240,FSlider.value);
myCamera.setQuality(BSlider.value,QSlider.value);
}
]]>
No comments for this entry yet...

Leave a Reply

You must be logged in to post a comment.