Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import flash.accessibility.Accessibility;
- import flash.display.Sprite;
- import flash.events.*;
- import flash.net.NetConnection;
- import flash.net.NetStream;
- import flash.media.Video;
- public class NsExample extends Sprite
- {
- private var nc:NetConnection;
- private var ns:NetStream;
- private var video:Video;
- public function NsExample()
- {
- video = new Video();
- addChild(video);
- nc = new NetConnection();
- nc.client=this;
- nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
- nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onError);
- nc.connect('rtmp://live.7cast.net/live');
- }
- private function startStreaming()
- {
- ns = new NetStream(nc);
- ns.client = this;
- ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
- ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onError);
- ns.play("ovaxh37k9yep18z");
- video.attachNetStream(ns);
- }
- private function onNetStatus(event:NetStatusEvent):void
- {
- switch(event.info.code)
- {
- case 'NetConnection.Connect.Success':
- trace('NetConnection.Connect.Success');
- startStreaming();
- break;
- default:
- trace(event.info.code);
- }
- }
- private function onError(event:AsyncErrorEvent):void
- {
- trace(event);
- }
- public function onMetaData(data)
- {
- for(var i in data){ trace(i + " = " + data[i])}
- trace(video.width, video.height,stage.stageWidth,stage.stageHeight);
- video.scaleY = video.scaleX;
- video.width = stage.stageWidth
- trace(video.scaleX,video.width, video.scaleY, video.height)
- video.x = (stage.stageWidth - video.width)/2;
- video.y = (stage.stageHeight - video.height)/2;
- }
- public function onBWDone ()
- {
- trace("on Bandwidth Done ");
- }
- }
- }
- output
- NetConnection.Connect.Success
- NetStream.Play.Reset
- NetStream.Play.Start
- videokeyframe_frequency = 10
- author =
- description =
- rating =
- creationdate = Fri Aug 09 21:10:36 2013
- width = 320
- presetname = Custom
- videocodecid = VP62
- videodevice = ManyCam Virtual Webcam
- audiocodecid = .mp3
- audiodatarate = 18
- audioinputvolume = 75
- copyright =
- title =
- videodatarate = 32
- framerate = 10
- audiosamplerate = 11025
- keywords =
- audiochannels = 1
- audiodevice = Microphone (Avnex Virtual Audio
- height = 180
- 320 240 640 480
- 2 640 1 240
- note
- 16:9 is stretched to width of the player but still 16:9.
- it is centered.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement