Red5 Media Server Forum: As3 rtmp video stream on localhost red5 path issue - Red5 Media Server Forum

Jump to content

Welcome to Red5 Media Server Forum

Join us now to get access to all our awesome features. Once registered and logged in, you will be able to create topics, post replies, and more!

Sign In » Register Now!

Previous Next

Recent Topics Added

Statistics

Total Posts
1,273
Total Members
3,881
Newest Member
tickss  
active user(s)
12 +
Online At Once Record
67

12 active user(s) (in the past 15 minutes)

0 members, 12 guests, 0 anonymous users
Show by: Last Click or Member Name
Google, Alexa

Upcoming Calendar Events

There are no forthcoming calendar events

0 member(s) have a birthday today

No members are celebrating a birthday today

Search

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

As3 rtmp video stream on localhost red5 path issue

having issue with giving the correct path to the video file.

  • Group: Members
  • Posts: 3
  • Joined: 23-January 12

Posted 23 January 2012 - 11:39 AM
#1

1
Hi,
Below is a sample application i have been developing in as3 flash based on ofla demo. But i seem to be having issues connecting to the stream.I am using the same video files as given with the red5 server demo installation.
my output trace traces out as a connection success and the play start of the video file. But i am unable to get its metadata or see it actually playing on the stage.

Quote

netStatusHandler NetConnection.Connect.Success
netStatusHandler NetStream.Play.Reset
netStatusHandler NetStream.Play.Start


getting this right would help in converting/reworking some of the as2 examples into as3.

package 
{
	import flash.display.*;
	import flash.events.NetStatusEvent;
	import flash.events.*;
	import flash.media.*;
	import flash.net.NetConnection;
	import flash.net.NetStream;
	import flash.events.Event;


	public class NetConnectionExample extends MovieClip
	{
		private var videoURL:String = "rtmp://localhost/oflaDemo/streams/avatar.flv";
		private var connection:NetConnection;
		private var stream:NetStream;
		public function NetConnectionExample()
		{
			// constructor code
			connection = new NetConnection();
			connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
			connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
			connection.connect(videoURL, true);
		}
		private function netStatusHandler(event:NetStatusEvent):void
		{
			trace("netStatusHandler",event.info.code);
			switch (event.info.code)
			{
				case "NetConnection.Connect.Success":
					connectStream();
					break;
				case "NetStream.Play.StreamNotFound":
					trace("Stream not found: " + videoURL);
					break;
			}
		}

		private function securityErrorHandler(event:SecurityErrorEvent):void
		{
			trace("securityErrorHandler: " + event);
		}

		private function connectStream():void
		{
			stream = new NetStream(this.connection);
			stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
			stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler)
			stream.client = new CustomClient();
			var video:Video = new Video();
			video.attachNetStream(stream);
			stream.play(videoURL);
			addChild(video);
		}
		function asyncErrorHandler(event:AsyncErrorEvent):void {
			// ignore AsyncErrorEvent events.
		}

	}
}

class CustomClient {
public function onMetaData(info:Object):void
{
	trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
}
public function onCuePoint(info:Object):void
{
	trace("cuepoint: time=" + info.time + " name=" + info.name + " type=" + info.type);
}
}


  • Group: Moderators
  • Posts: 96
  • Joined: 06-April 11

Posted 25 February 2012 - 06:38 AM
#2

0
small error

your context for netconnection should not contain the file name

 private var videoURL:String = "rtmp://localhost/oflaDemo/streams/"


is what it shouldl say.

and then you have another problem where your play command should not contain the context.

 stream.play("avatar.flv"");


is what it should look like.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


1 User(s) are reading this topic 0 members, 1 guests, 0 anonymous users



Skin and Language

Sign in here


Sign in options
Log in with Facebook Log in with Twitter   Go to advanced login Register Now!
Put your own