Friday, October 23, 2009

Red5 Live Audio Streaming Delay Solution


I finally came across a solution for the Red5 live audio streaming delay problem... turns out, it is simply caused by specifying a buffer on the audio stream of the listening client... which makes sense!

The flash movie connected to the live audio stream will hold back on playing the audio until it has x seconds buffered... it can never get closer to real time than the length of audio buffered.

mediaStreamLive = new NetStream(this.red5Connection);

So, between having a fast hosting server, and minimal buffer time, we are now achieving near real-time audio transmission rates.

Tuesday, October 20, 2009

Red5 0.7.0 Logging Success!!

Well, for the first time today, I got the Red5 logback logger to work.

The revelation hit me when I realized after reading:

That the log directory is expected in a different location depending on whether you use the red5.bat, or the Windows Service to launch the red5 server.

The demo applications which write to a log have logback.xml in the folder:

i) With the red5.bat launching method, all of the demo webapps merrily log to their logs using the XML reference to the log directory of:

ii) With the Windows service launching method, the demo apps all stop logging... unless you change the XML reference to the log directory of:

logback.xml Red5 Notes:

i) Change all the "myAppenderNameHere" references to be the same string (your choice)
ii) Change "" to the package name of your red5 java application.

<?xml version="1.0" encoding="UTF-8"?>
<appender name="myAppenderNameHere" class="ch.qos.logback.core.FileAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
%date [%thread] %-5level %logger{35} - %msg%n
<level value="DEBUG" />
<appender-ref ref="myAppenderNameHere" />
<logger name="">
<level value="DEBUG" />

Java code:

i) The following 2 imports are required:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

ii) And in my constructor, I configure the Logger:

public class Application extends ApplicationAdapter {
protected static Logger log = LoggerFactory.getLogger(Application.class);
[..... other code follows .... ]

iii) And then I call the logger methods.

public boolean appConnect( IConnection conn , Object[] params ){"appConnect id: " + conn.getClient().getId() );

Hopefully this clears things up. Let me know how things go!