All live streams can be configured through user interaction by calling IltmsLiveStreamDevConfig::ShowDialog. Unfortunately, IltmsLiveStreamDevConfig::ShowDialog does not allow live stream devices to be set up programmatically. The streaming toolkit does, however, support the URL used by the capture device to be specified directly. Specifying the URL allows simple configurations of RTSP, ONVIF, and UDP live streams to be implemented. Perform the following steps to set up a simple URL-based stream:
1. |
Get the list of current live sources in the server by calling IltmsServer::GetLiveStreams. |
2. |
Create a new live stream through IltmsLiveStreams::CreateLiveStream. |
3. |
Set the server URL to access the stream via IltmsLiveStream::put_Path. |
4. | Get the video devices through IltmsLiveStream::get_VideoDevices. |
5. | Search for the device index by calling IltmsDevices::Find with the following names: For RTSP use "@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}{E2B7DE48-38C5-11D5-91F6-00104BDB8FF9}"For ONVIF use "@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}{5CEF7131-CD23-447D-BFAF-EDF99CF03F53}" For UDP use "@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}{E2B7DF17-38C5-11D5-91F6-00104BDB8FF9}" |
6. | Select the device by calling IltmsDevices::put_Selection with the index returned in the previous step. |
7. | Call IltmsLiveStream::put_VideoDeviceURL to configure the device's URL. |
8. | (Optional) Set additional properties such as the audio type, video size, video frame rate, or whether to use hardware compression. For more information, see IltmsLiveStream. |
9. | Add the new configuration to the existing list of streams through IltmsLiveStreams::AddLiveStream. |
10. | Update the server configuration with the list of live streams by calling IltmsServer::SetLiveStreams. |