10.1 RedBox overview
The RedBox project is a free add-on for SmartFoxServer PRO that adds audio and video streaming capabilities,
making it possible to integrate these features in any existing SmartFoxServer application.
Implementing an A/V chat has never been this simple with SmartFoxServer:
- Easy A/V chatting and streaming thanks to the RedBox add-on.
- Advanced features for A/V chat invitations, live events, managing the list of media files and more...
- Powerful room/user/buddy management through the SmartFoxServer framework and API
The RedBox add-on comes for free including source code, allowing developers to further expand its functionalities!
The features implemented out-of-the-box by the RedBox are:
- Live one-to-one audio/video chat
- Live events (one broadcaster, many subscribers)
- Remote A/V recording (video messages etc...)
- Video streaming
- New simple API for handling A/V chat invitations, streaming etc...
» The components
The RedBox comes with both server-side and a client-side elements. Once you have installed SmartFoxServer PRO you will find the following components:
- Server/RedBox/
This is the server-side part. The RedBox is based on the free, open-source Red5 streaming server.
-
Flash API/RedBoxClient_AS3/
Here you find the RedBox client side API classes with relative sources.
-
Examples/Redbox/
Here you find complete ActionScript 3 projects showing the each of the RedBox major features. Each example comes with fully commented source code.
-
Server/javaExtensions/
In this folder you find the server-side extensions used by the RedBox, in the package com.smartfoxserver.redbox
You also find the complete extension source code in the RedBoxExtension.zip file.
-
redbox.properties file:
The file is located in the Server/ folder and it can be used to configure a few RedBox settings:
- log: toggles RedBox server side logging
- red5Path: points to the Red5 location
- lastModifiedFormat: specifies "Last modified" date format in a/v clip data
- The documentation of the client side RedBox API is found in this same section of the documentation (10.4)
» Trying the examples
Follow these simple steps:
- Start SmartFoxServer PRO
-
Start Red5:
- Windows: double click red5.bat
- MacOS X: double click Red5 application
- Linux / Unix: launch the red5.sh script
-
Go to the Examples/RedBox/ folder and run any of the examples available. The SWF files are located inside each example's folder
inside the bin/ directory.
Problems running the examples?
Make sure the Flash Player security sandbox is not silently blocking access to your local files or network.
Go the Flash Player Global Security Settings page
and make sure that the SWF file is listed in the allowed list.
Tip: if you don't want to allow each file individually you can add the entire folder that contains all the examples.
» Creating your own RedBox applications
Adding live audio/video streams to your existing applications or creating a brand new one is very simple.
All you have to do is importing the RedBox client class(es) based on what your application will do.
The Rebdox API have been split into various classes:
-
AVChatManager:
This class is responsible for audio/video chat implementation by means of the connection to the Red5 server.
The AVChatManager handles the chat workflow (send request, accept or refuse it, establish or stop connection, etc.) and the live streaming to/from the Red5 server.
-
AVClipManager:
This class is responsible for audio/video clip recording & playback through the connection to the Red5 server.
The AVClipManager handles the list of available a/v clips, their custom additional properties and the streaming to/from the Red5 server.
-
AVCastManager:
This class is responsible for managing audio/video live casts inside the room joined by the user, making it possible to create live web events or a/v conferences.
The AVCastManager handles the live cast publishing/playing to/from the Red5 server.
Unlike the other RedBox classes, the AVCastManager works on a room basis to leverage the access control and moderation features of SmartFoxServer rooms.
On the server side you will simply add the RedBox extension to your Zone.
This will activate the RedBox services for your application.
You should add this line in your XML Zone declaration:
<Extensions>
<extension name="__$RedBox$__" className="com.smartfoxserver.redbox.RedBoxExtension" type="java" />
</Extensions>
The name assigned to the extension __$RedBox$__ is mandatory and should not be changed.