getStreamUri method
This operation requests a Uri that can be used to initiate a live media
stream using RTSP as the control protocol. The returned URI shall remain
valid indefinitely even if the profile is changed. The validUntilConnect
,
validUntilReboot
and Timeout Parameter shall be set accordingly (
validUntilConnect=false, validUntilReboot=false, timeout=PT0S).
The correct syntax for the StreamSetup element for these media stream setups defined in 5.1.1 of the streaming specification are as follows: RTP unicast over UDP: StreamType = "RTP_unicast", TransportProtocol = "UDP" /// RTP over RTSP over HTTP over TCP: StreamType = "RTP_unicast", TransportProtocol = "HTTP" /// RTP over RTSP over TCP: StreamType = "RTP_unicast", TransportProtocol = "RTSP"
If a multicast stream is requested at least one of videoEncoderConfiguration, audioEncoderConfiguration and metadataConfiguration shall have a valid multicast setting.
For full compatibility with other ONVIF services a device should not generate Uris longer than 128 octets.
Implementation
Future<MediaUri> getStreamUri(String profileToken,
{String streamType: 'RTP_unicast',
String transportProtocol: 'RTSP',
bool validUntilConnect = false,
bool validUntilReboot = false,
String timeout = 'PT0S'}) async {
final envelope = await Soap.retrieveEnvlope(
uri,
onvif.secureRequest(SoapRequest.streamUri(profileToken,
streamType: streamType, transportProtocol: transportProtocol)));
if (envelope.body.streamUriResponse == null) throw Exception();
return envelope.body.streamUriResponse!.mediaUri;
}