在使用DLNA_UPnP 进行iOS投屏时发现失败
失败信息是
<errorCode>501</errorCode><errorDescription>Current state of service prevents invoking that action. Action method invocation failed: java.lang.reflect.UndeclaredThrowableException</errorDescription>
- 解决办法是要加一个DIDL-Lite标签
#define VideoDIDL @"<DIDL-Lite xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:sec=\"http://www.sec.co.kr/\" xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\"><item id=\"f-0\" parentID=\"0\" restricted=\"0\"><dc:title>Video</dc:title><dc:creator>Anonymous</dc:creator><upnp:class>object.item.videoItem</upnp:class><res protocolInfo=\"http-get:*:video/*:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000\" sec:URIType=\"public\">%@</res></item></DIDL-Lite>"
- (void)setAVTransportURL:(NSString *)urlStr{
CLUPnPAction *action = [[CLUPnPAction alloc] initWithAction:@"SetAVTransportURI"];
[action setArgumentValue:@"0" forName:@"InstanceID"];
[action setArgumentValue:urlStr forName:@"CurrentURI"];
[action setArgumentValue:VideoDIDL forName:@"CurrentURIMetaData"];
[self postRequestWith:action];
}