DLNA SetAVTransportURI

Nov 4, 2011 at 1:40 PM
Edited Nov 4, 2011 at 1:41 PM

Im trying to set the video for the vide my tv is playing. Its a Samsung UE556500.

a.Service.InvokeAction("SetAVTransportURI", new object[] { 0, "http://192.168.1.3:8080/Misfits.S03E01.WS.PDTV.XviD-RiVER.avi", "" }).ConsoleDump();

The code Im having problem with is:

      void discovery_ServiceAdded(object sender, ServiceAddedEventArgs a)
        {
            if (a.Service.Device.DocumentURL.Equals("http://192.168.1.5:52235/dmr/SamsungMRDesc.xml") && a.Service.FriendlyServiceTypeIdentifier.Equals("AVTransport:1"))
            {
                a.Service.InvokeAction("SetAVTransportURI", new object[] { 0, "http://192.168.1.3:8080/Misfits.S03E01.WS.PDTV.XviD-RiVER.avi", "" }).ConsoleDump();
            }
        }

InvokeAction throws an exception "Exception from HRESULT: 0x80040369".

Microsoft Network Monitor reports "HTTP:Response, HTTP/1.1, Status: Precondition failed, URL:" with "Error!Your http header have something wrong by your client"

Invoking Play Pause Stop works so the soap-protocol/http-headers should work.

I have checked the dlna specifications for AVTransport and errorcode 369 is to low. Do i have to invoke a action before invoking SetAVTransportURI?

Coordinator
Nov 4, 2011 at 3:16 PM
Edited Nov 4, 2011 at 3:29 PM

Fernixbond,

First of all that error sounds like its a problem with the specific soap request for the call to that action, this is why I think it could be something to do with the URL, maybe you should try escaping the URL? The best way for you to determine what the problem is, is to use a packet snooper and see what data is being sent to and from your Samsung TV, pay close attention to the headers and XML soap data to ensure it is intact and escaped properly, i use a program called Snoop2 which utilises WinPCap.

 

Also, can you please send me the XML description document for the devices and services for your Samsung TV?

Another thing, according to the AVTransport:1 document here:

http://www.upnp.org/specs/av/UPnP-av-AVTransport-v1-Service.pdf

 

The third parameter of the SetAVTransportURI action should be set to NOT_IMPLEMENTED if it is not implement, not an empty string, maybe you could try that as well.

 

Also, i noticed you are passing 0 for the first parameter ( InstanceID ), however according to the same service document:

  "This state variable is introduced to provide type information for the “InstanceID” input parameter presentin all AVTransport actions. It identifies the virtual instance of the AVTransport service to which the actionapplies. A valid InstanceID is obtained from a ‘factory’ method in the ConnectionManager service: the PrepareForConnection action."

So you should be calling PrepareForConnection to get the instance ID, i realise the error you are getting dosnt sound like any of these issues, but sometimes the errors can be strange and wonderful when working with UPnP.

 

Another thing, are you sure your TV implements the UPnP properly, you would be surprised how many devices dont implement certain features properly.

 

Last of all, it COULD be a bug in the Microsoft UPnP implmenetation, what OS are you using, because I have found the UPnP implementation in Windows 7 to be MUCH better than windows xp. The framework itself does not handle anything to do with the SOAP request, it lets the UPnP COM objects handle that, so you will need to do some packet sniffing to find the problem if you cant find it with trial and error.

 

Thanks

Aaron

Nov 5, 2011 at 3:23 PM

it works now. It was the third parameter, CurrentURIMetaData, that could not be empty.

My TV does not implement PrepareForConnection

Thanks for the help, Aaron!

Coordinator
Nov 6, 2011 at 9:38 AM

Thats great, im glad you got it working! :)

If I could trouble you to do a review that of Managed UPnP that would be great, id love to get more feedback!

Thanks,

TheToid