getSnapshotUri method
A client uses the getSnapshotUri command to obtain a JPEG snapshot from
the device. 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 URI can be used for
acquiring a JPEG image through a HTTP GET operation. The image encoding
will always be JPEG regardless of the encoding setting in the media
profile. The Jpeg settings (like resolution or quality) may be taken from
the profile if suitable. The provided image will be updated automatically
and independent from calls to getSnapshotUri.
Implementation
Future<MediaUri> getSnapshotUri(String profileToken,
{bool validUntilConnect = false,
bool validUntilReboot = false,
String timeout = 'PT0S'}) async {
final envelope = await Soap.retrieveEnvlope(
uri, onvif.secureRequest(SoapRequest.snapshotUri(profileToken)));
if (envelope.body.snapshotUriResponse == null) throw Exception();
return envelope.body.snapshotUriResponse!.mediaUri;
}