My question is Im building a website that requires live video streaming. we have a VPS from arvixe with red5 installed but I can not connect to red5 with rtmp. I need to know if this is a code eror on my part or if I just need help finding the proper rtmp address to connect to in my action script 3.
here is my code so far:
import flash.media.Camera;
import flash.media.Video;
import flash.media.Microphone;
import flash.net.URLVariables;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.*;
import flash.display.MovieClip;
import flash.net.*;
import flash.text.*;
var nc:NetConnection = new NetConnection();
nc.connect("rtmp://198.58.95.110:1935/");
var ns:NetStream = new NetStream(nc);
var camera:Camera = Camera.getCamera();
var video:Video = new Video();
video.smoothing = true;
video.attachCamera(camera);
ns.attachCamera(camera);
ns.publish("cam1");
addChild(video);
then I changed it to this:
import flash.media.Camera;
import flash.media.Video;
import flash.media.Microphone;
import flash.net.URLVariables;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.*;
import flash.display.MovieClip;
import flash.net.*;
import flash.text.*;
var nc:NetConnection = new NetConnection();
var ns:NetStream = new NetStream(nc);
var camera:Camera = Camera.getCamera();
var video:Video = new Video();
video.smoothing = true;
video.attachCamera(camera);
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nc.connect("rtmp://cam320.arvixevps.com:5080");
function netStatusHandler(event:NetStatusEvent):void {
if (event.info.code == "NetConnection.Connect.Success") {
ns.attachCamera(camera);
ns.publish("livecam1");
}
}
Next Code I tried:
import flash.media.Camera;
import flash.media.Video;
import flash.media.Microphone;
import flash.net.URLVariables;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.*;
import flash.display.MovieClip;
import flash.net.*;
import flash.text.*;
var nc:NetConnection = new NetConnection();
nc.connect("rtmp://cam320.arvixevps.com/webapps/oflaDemo");
var ns:NetStream = new NetStream(nc);
var camera:Camera = Camera.getCamera();
var video:Video = new Video();
video.smoothing = true;
video.attachCamera(camera);
nc.addEventListener(NetStatusEvent.NET_STATUS, publish);
addChild(video);
function publish(event:NetStatusEvent):void {
if (event.info.code == "NetConnection.Connect.Success"){
ns.attachCamera(camera);
ns.publish("cam1");
}
}
red5.log file looks like this:
2013-02-02 14:07:34,612 [main] INFO org.red5.server.Launcher - Red5 Server 0.9.0 $Rev: 4030 $ (http://code.google.com/p/red5/)
2013-02-02 14:07:34,726 [main] INFO o.s.c.s.FileSystemXmlApplicationContext - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@5ff06dc3: startup date [Sat Feb 02 14:07:34 PST 2013]; root of context hierarchy
2013-02-02 14:07:35,281 [main] INFO o.s.b.f.c.PropertyPlaceholderConfigurer - Loading properties file from class path resource [red5.properties]
2013-02-02 14:07:35,293 [main] INFO o.s.b.f.s.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@69d95da8: defining beans [placeholderConfig,red5.common,red5.core,context.loader,pluginLauncher,tomcat.server]; root of factory hierarchy
2013-02-02 14:07:35,326 [main] INFO o.s.c.s.FileSystemXmlApplicationContext - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@7cf01771: startup date [Sat Feb 02 14:07:35 PST 2013]; root of context hierarchy
2013-02-02 14:07:35,546 [main] INFO o.s.b.f.c.PropertyPlaceholderConfigurer - Loading properties file from class path resource [red5.properties]
2013-02-02 14:07:35,552 [main] INFO o.s.b.f.s.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1118fa47: defining beans [placeholderConfig,red5.server,jmxFactory,jmxAgent,serializer,deserializer,statusObjectService,rtmpCodecFactory,rtmptCodecFactory,remotingCodecFactory,streamableFileFactory,filePersistenceThread,sharedObjectService,streamService,providerService,consumerService,bandwidthFilter,schedulingService,warDeployService,remotingClient,object.cache,keyframe.cache,flv.impl,flvreader.impl,mp4reader.impl,mp3reader.impl,org.springframework.beans.factory.config.MethodInvokingFactoryBean#0,org.springframework.beans.factory.config.MethodInvokingFactoryBean#1,streamExecutor,playlistSubscriberStream,clientBroadcastStream]; root of factory hierarchy
2013-02-02 14:07:35,717 [main] WARN o.s.b.GenericTypeAwarePropertyDescriptor - Invalid JavaBean property 'enableRmiAdapter' being accessed! Ambiguous write methods found next to actually used [public void org.red5.server.jmx.JMXAgent.setEnableRmiAdapter(java.lang.String)]: [public void org.red5.server.jmx.JMXAgent.setEnableRmiAdapter(boolean)]
2013-02-02 14:07:35,717 [main] WARN o.s.b.GenericTypeAwarePropertyDescriptor - Invalid JavaBean property 'enableSsl' being accessed! Ambiguous write methods found next to actually used [public void org.red5.server.jmx.JMXAgent.setEnableSsl(java.lang.String)]: [public void org.red5.server.jmx.JMXAgent.setEnableSsl(boolean)]
2013-02-02 14:07:35,717 [main] WARN o.s.b.GenericTypeAwarePropertyDescriptor - Invalid JavaBean property 'enableMinaMonitor' being accessed! Ambiguous write methods found next to actually used [public void org.red5.server.jmx.JMXAgent.setEnableMinaMonitor(java.lang.String)]: [public void org.red5.server.jmx.JMXAgent.setEnableMinaMonitor(boolean)]
2013-02-02 14:07:36,400 [main] INFO org.red5.server.service.WarDeployer - War deployer service created
2013-02-02 14:07:36,493 [main] INFO o.s.c.s.FileSystemXmlApplicationContext - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@9c6a99d: startup date [Sat Feb 02 14:07:36 PST 2013]; parent: ApplicationContext 'red5.common'
2013-02-02 14:07:36,683 [main] INFO o.s.b.f.c.PropertyPlaceholderConfigurer - Loading properties file from class path resource [red5.properties]
2013-02-02 14:07:36,691 [main] WARN o.s.b.f.c.CustomEditorConfigurer - Passing PropertyEditor instances into CustomEditorConfigurer is deprecated: use PropertyEditorRegistrars or PropertyEditor class names instead. Offending key [java.net.SocketAddress; offending editor instance: org.apache.mina.integration.beans.InetSocketAddressEditor@77a9f87c
2013-02-02 14:07:36,695 [main] INFO o.s.b.f.s.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7bbf68a9: defining beans [customEditorConfigurer,placeholderConfig,rtmpMinaConnManager,rtmpHandler,rtmpMinaIoHandler,rtmpTransport,rtmpMinaConnection,rtmptConnManager,rtmptHandler,rtmptServlet,rtmptConnection,rtmpsMinaIoHandler,rtmpsTransport]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@1118fa47
2013-02-02 14:07:36,718 [main] INFO o.r.s.net.rtmp.RTMPMinaTransport - RTMP Mina Transport bound to /0.0.0.0:1935
2013-02-02 14:07:36,719 [main] INFO o.r.s.net.rtmp.RTMPMinaTransport - RTMP Mina Transport Settings
2013-02-02 14:07:36,719 [main] INFO o.r.s.net.rtmp.RTMPMinaTransport - Connection Threads: 4
2013-02-02 14:07:36,719 [main] INFO o.r.s.net.rtmp.RTMPMinaTransport - I/O Threads: 16
2013-02-02 14:07:36,785 [main] INFO o.r.s.net.rtmp.RTMPMinaTransport - TCP No Delay: true
2013-02-02 14:07:36,785 [main] INFO o.r.s.net.rtmp.RTMPMinaTransport - Receive Buffer Size: 65536
2013-02-02 14:07:36,785 [main] INFO o.r.s.net.rtmp.RTMPMinaTransport - Send Buffer Size: 271360
2013-02-02 14:07:36,795 [main] INFO o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7bbf68a9: defining beans [customEditorConfigurer,placeholderConfig,rtmpMinaConnManager,rtmpHandler,rtmpMinaIoHandler,rtmpTransport,rtmpMinaConnection,rtmptConnManager,rtmptHandler,rtmptServlet,rtmptConnection,rtmpsMinaIoHandler,rtmpsTransport]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@1118fa47
2013-02-02 14:07:36,796 [main] INFO o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@69d95da8: defining beans [placeholderConfig,red5.common,red5.core,context.loader,pluginLauncher,tomcat.server]; root of factory hierarchy
2013-02-02 14:07:36,796 [main] INFO o.s.c.s.FileSystemXmlApplicationContext - Closing ApplicationContext 'red5.common': startup date [Sat Feb 02 14:07:35 PST 2013]; root of context hierarchy
2013-02-02 14:07:36,796 [main] INFO o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1118fa47: defining beans [placeholderConfig,red5.server,jmxFactory,jmxAgent,serializer,deserializer,statusObjectService,rtmpCodecFactory,rtmptCodecFactory,remotingCodecFactory,streamableFileFactory,filePersistenceThread,sharedObjectService,streamService,providerService,consumerService,bandwidthFilter,schedulingService,warDeployService,remotingClient,object.cache,keyframe.cache,flv.impl,flvreader.impl,mp4reader.impl,mp3reader.impl,org.springframework.beans.factory.config.MethodInvokingFactoryBean#0,org.springframework.beans.factory.config.MethodInvokingFactoryBean#1,streamExecutor,playlistSubscriberStream,clientBroadcastStream]; root of factory hierarchy
2013-02-02 14:09:12,350 [NioProcessor-1] INFO o.red5.server.net.rtmp.RTMPHandler - Connecting to: [WebScope@218c6982 Depth = 1, Path = '/default', Name = 'installer']
2013-02-02 14:09:39,316 [NioProcessor-1] INFO o.red5.server.net.rtmp.RTMPHandler - Connecting to: [WebScope@218c6982 Depth = 1, Path = '/default', Name = 'installer']
2013-02-02 14:15:10,259 [NioProcessor-1] INFO o.red5.server.net.rtmp.RTMPHandler - Connecting to: [WebScope@218c6982 Depth = 1, Path = '/default', Name = 'installer']
2013-02-02 14:34:34,089 [NioProcessor-1] INFO o.red5.server.net.rtmp.RTMPHandler - Scope webapps/oflaDemo not found on cam320.arvixevps.com
2013-02-02 14:34:36,935 [Red5_Scheduler_Worker-11] WARN o.r.server.net.rtmp.RTMPConnection - Closing RTMPMinaConnection from 184.63.74.33 : 11053 to cam320.arvixevps.com (in: 3433 out 3266 ), with id 415926013 due to long handshake
2013-02-02 14:34:55,728 [NioProcessor-1] INFO o.red5.server.net.rtmp.RTMPHandler - Scope webapps/oflaDemo not found on cam320.arvixevps.com
2013-02-02 14:34:58,998 [Red5_Scheduler_Worker-12] WARN o.r.server.net.rtmp.RTMPConnection - Closing RTMPMinaConnection from 184.63.74.33 : 11081 to cam320.arvixevps.com (in: 3433 out 3266 ), with id 814254349 due to long handshake
2013-02-02 15:59:32,847 [NioProcessor-1] INFO o.red5.server.net.rtmp.RTMPHandler - Scope webapps/oflaDemo not found on cam320.arvixevps.com
2013-02-02 15:59:35,845 [Red5_Scheduler_Worker-10] WARN o.r.server.net.rtmp.RTMPConnection - Closing RTMPMinaConnection from 184.63.74.33 : 13181 to cam320.arvixevps.com (in: 3433 out 3266 ), with id 2104928456 due to long handshake
2013-02-02 16:00:27,050 [NioProcessor-1] INFO o.red5.server.net.rtmp.RTMPHandler - Scope webapps/oflaDemo not found on cam320.arvixevps.com
2013-02-02 16:00:30,974 [Red5_Scheduler_Worker-11] WARN o.r.server.net.rtmp.RTMPConnection - Closing RTMPMinaConnection from 184.63.74.33 : 13226 to cam320.arvixevps.com (in: 3433 out 3266 ), with id 9885998 due to long handshake
still no luck getting it to work plus where the webcam used to show up before adding the netconnection and netstream code to my action script. Ofcourse Ive been trying to figure out for a few days and no luck. I think the problem is at nc.connect("rtmp://cam320.arvixevps.com:5080"); but not sure what the proper address for red5's default rtmp is so have no clue what to put here. Plus Im not sure if there is any erors in my code since I haven't been working with action script for too long. Unfortunatelly I have a deadline to meet to build this website and Im running short on time. but if someone could atleast point me in the right direction or show me what I did wrong I can fix it and finish this website. oh the VPS is running linux centos 5.I hope someone can help me here. This red5 rtmp connection issue is pissing me off. I just want to know how to fix this and make it connect to red5 correctly with out creating a webapp in flex. I should just be able to use Actionscript3 to connect to red5 then stream live video and not have to create a application with flex. I should say do i need anything besides red5 and my actionscripts to stream live webcam video? what does scope weapps/oflaDemo not found at cam320.arvixevps.com really mean?