MMS streaming
MMS streaming is activated when NetworkStreaming = ns_ASFDirectNetworkStreaming.
The TCP port is specified by ASFNetworkPort.
If ASFNetworkPort = 0, an available port is assigned automatically. This port is returned by the OnDirectNetworkStreamingHostUrl event, which also returns the full URL that can be given to the users to connect to this network stream. This streaming URL is also returned by the StreamingURL property.
Increasing the default limitation of 5 concurrent clients
By default, a standard ("non-server") Windows PC is limited to 5 concurrent connections. This limit can be increased to a maximum of 50 connections by modifying the value of the HKEY_CLASSES_ROOT\Software\Microsoft\Windows Media Tools\Encoder\MaxClientConnections registry key.
Controlling the connected users
- The maximum number of users that can connect to this network stream is specified by the ASFNetworkMaxUsers property (default value: 5 users).
- The current number of connected users is returned by the ASFStreaming_GetConnectedClientsCount function.
- The list of the connected users is returned by the ASFStreaming_GetConnectedClients function, as a string (lines separated by CR/LF).
- To block an IP address (or a group of IP addresses), invoke ASFStreaming_SetAuthorization.
- The list of the blocked IP addresses is returned by the ASFStreaming_GetAuthorizationList function, as a string (lines separated by CR/LF).
- To clear the list of the blocked IP addresses, invoke ASFStreaming_ResetAuthorizations.
Sample code (server side)
Streaming a live video source (video only):
VideoGrabber1.VideoDevice:= 0;
VideoGrabber1.NetworkStreaming:= ns_ASFDirectNetworkStreaming;
VideoGrabber1.NetworkStreamingType:= nst_VideoStreaming;
VideoGrabber1.ASFNetworkPort:= 10500;
VideoGrabber1.StartPreview;
Streaming a live video source (audio + video):
VideoGrabber1.VideoDevice:= 0;
VideoGrabber1.AudioDevice:= 0;
VideoGrabber1.NetworkStreaming:= ns_ASFDirectNetworkStreaming;
VideoGrabber1.NetworkStreamingType:= nst_AudioVideoStreaming;
VideoGrabber1.ASFNetworkPort:= 10500;
VideoGrabber1.StartPreview;
Streaming a video clip:
VideoGrabber1.VideoSource:= vs_VideoFileOrURL;
VideoGrabber1.VideoSource_FileOrURL:= 'replace by the file path to the video clip';
VideoGrabber1.NetworkStreaming:= ns_ASFDirectNetworkStreaming;
VideoGrabber1.NetworkStreamingType:= nst_AudioVideoStreaming;
VideoGrabber1.ASFNetworkPort:= 10500;
VideoGrabber1.StartPreview;
To view the stream on the client, open the server URL, which is built as follows:
mms://IP:port
E.g., if the server IP is 192.168.0.123 and the streaming port is 10500, the URL is mms://192.168.0.123:10500.
To find out the IP address of the server:
- either run IPConfig on the server to show it,
- or use the OnDirectNetworkStreamingHostUrl event (on the server), which directly returns the URL to open in the client (HostUrl parameter) when the preview or recording starts.
Sample code (client side)
In the samples below, the server IP is 192.168.0.123 and the port is 10500, so the URL is mms://192.168.0.123:10500.
Without the optional Datastead RTSP DirectShow source filter:
VideoGrabber1.VideoSource:= vs_VideoFileOrURL;
VideoGrabber1.VideoSource_FileOrURL:= 'mms://192.168.0.123:10500';
VideoGrabber1.StartPreview;
With the optional Datastead RTSP DirectShow source filter installed on the client:
VideoGrabber1.VideoSource:= vs_VideoFileOrURL;
VideoGrabber1.VideoSource_FileOrURL:= 'mmsh://192.168.0.123:10500';
VideoGrabber1.StartPreview;