Closed Flynn2018 closed 1 year ago
// get the stream uri as a string independent of whether it supports Media1 or Media2.
// where media1.getStreamUri and media2.getStreamUri are just building the SOAP request
// and parsing the SOAP response from the device.
Future<String> getStreamUri(String profileToken) async {
dynamic streamUri = _mediaSupportLevel == MediaSupportLevel.one
? await media1.getStreamUri(profileToken,
streamSetup: StreamSetup(
stream: 'RTP-Unicast',
transport: Transport(protocol: 'HTTP'),
))
: await media2.getStreamUri(profileToken);
return (streamUri is String) ? streamUri : (streamUri as m1.MediaUri).uri;
}
The package does not perform any operations on the response from the device. If you are getting the value "rtsp://ip:80/Streaming/Channels/1?transportmode=unicast&profile=Profile_1" it might be that the default Transport
value of HTTP is causing an issue with your device, which the Onvif spec allows but maybe your device doesn't support it. A temporary work-around would be to use this code to get the stream uri:
var streamUri = await onvif.media1.getStreamUri(profileToken,
streamSetup: StreamSetup(
stream: 'RTP-Unicast',
transport: Transport(protocol: 'RTSP'),
));
I'll also look at adjusting the default.
What other values can be taken for the parameter stream besides the value 'RTP Unicast'?
Hi @Flynn2018,
The method is documented here https://pub.dev/documentation/easy_onvif/2.1.0-dev.17/media1/GetStreamUriResponse-class.html
The port 80 in the reponse when calling the method onvif.media.getStreamUri(profileToken) such as rtsp://ip:80/Streaming/Channels/1?transportmode=unicast&profile=Profile_1 seems not correct, it shoud be 554. Becaue the method onvif.deviceManagement.getNetworkProtocols() return {name:RTSP,enabled:true,port:554}.