This article mainly introduces the use of fluorinefx.net to achieve video recording and video playback, FluorineFX like FMS, in addition to the AMF Communication, rtmp protocol, RPC and remote sharing objects, it also has the function of video streaming services. It is very convenient for us to realize the development of similar applications such as online video recording, live video, video chatting and video conferencing.
In the FMS3 series (four): Online video recording, video playback in this article I wrote the implementation of online video recording and video playback through the FMS function, the client development and this article is the same, the difference is that this article will use Flex to develop.
First we take a look at how to use the FLUORINEFX server is developed, the establishment of applicationadapter is inevitable, here we have for the sample program in this article established Applicationadapter for Videoapplication, and add Remotingserviceattribute to the following code block:
namespace Fx.Adapter
{
/// <summary>
/// 视频应用
/// </summary>
[RemotingService]
public class VideoApplication : ApplicationAdapter
{
public override bool AppStart(IScope application)
{
return base.AppStart(application);
}
public override bool AppConnect(IConnection connection, object[] parameters)
{
return base.AppConnect(connection, parameters);
}
}
}
The method provided by the Applicationadapter template is rewritten in the actual project development according to its own requirements, and is not introduced here. This is still unable to achieve the video recording and playback functions, this is only to achieve the basic starting application and client connection, and other basic functions, to achieve video recording and playback, we have to let videoapplication implement Istreamservice interface, This interface provides the appropriate functionality to implement video publishing and playback, defined as follows:
Namespace FluorineFx.Messaging.Api.Stream
{
[CLSCompliant (False)]
Public interface Istreamservice:iscopeservice, IService
{
void Closestream ();
int CreateStream ();
void Deletestream (int streamid);
void Deletestream (istreamcapableconnection connection, int streamid);
void Pause (bool pauseplayback, double position);
void Play (bool dontstop);
void Play (string name);
void Play (string name, double start);
void Play (string name, double start, double length);
void Play (string name, double start, double length, bool flushplaylist);
void publish (bool dontstop);
void Publish (string name);
void Publish (string name, string mode);
void Receiveaudio (bool receive);
void Receivevideo (bool receive);
void Releasestream (string streamname);
void seek (double position);
}
}