<< Click to display table of contents >> TRVMediaServer |
TRVMediaServer translates data (video, audio, commands, files) from multiple TRVCamSenders to multiple TRVCamReceivers via the network.
Unit [VCL and LCL] MRVMediaServer;
Unit [FMX] fmxMRVMediaServer;
Syntax
TRVMediaServer = class(TComponent)
TObject TPersistent TComponent |
To start the server, define its HTTPPort and UDPPort, and assign HTTPActive and UDPActive = True.
Multiple clients may be connected to a server via the network. Each client may consists of one or more TRVCamSenders and one TRVCamReceiver, having the same identifiers (TRVCamSender.GUIDFrom, TRVCamReceiver.GUIDMy; TRVCamSender.UseGUID must be True). If the second client with the same identifier is connected, the server disconnects the first client.
Two senders in the same client may be necessary to use different protocols: the first sender may send video and audio using UDP, the second sender may send commands, binary data and files using TCP or HTTP. Protocol is specified in TRVCamSender.Protocol. TCP or HTTP senders must be connected to HTTPPort, UDP senders must be connected to UDPPort. TCP or HTTP senders must have TCPConnectionType = rvtcpSenderToReceiver.
A receiver is always connected to the server using TCP or HTTP. It must have TCPConnectionType = rvtcpReceiverToSender.
If two clients know identifiers of each other, they can send data to each other via the server. The identifier of the other client can be specified in TRVCamSender.GUIDTo (or similar parameters of methods sending commands, files, etc.)
This type of communication can be used to implement private talks.
Another way to establish communication between clients is adding them to the same group.
A client may add itself to a group on the server by calling TRVCamSender.JoinGroup, and remove itself from the group by calling TRVCamSender.LeaveGroup.
Existing group members are notified in TRVCamReceiver.OnUserJoinsGroup and OnUserLeavesGroup.
A client may request a list of group members by calling TRVCamSender.GetUsersFromGroup; in response, TRVCamReceiver.OnGetGroupUsers is called.
The target group for data can be specified in TRVCamSender.GUIDTo (or similar parameters of methods sending commands, files, etc.)
This type of communication can be used to implement chat rooms.
The count of groups may be limited using MaxGroupCount property.
Another way to establish communication between clients is a list of default receivers.
If a sender does not have GUIDTo and GUIDGroup specified, data from it are sent to default receivers.
Default receivers may be used to implement contact lists (together with allowed senders).
See also:
•TRVCamSender's methods for management of default receivers
•KeepClientInfoMode property