public boolean setAVTransportURI( Device dev, ItemNode itemNode) { if (dev == null) return false; ResourceNode resNode = itemNode.getFirstResource(); if (resNode == null) return false; String resURL = resNode.getURL(); if (resURL == null || resURL.length() <= 0) return false; Service avTransService = dev.getService(AVTransport.SERVICE_TYPE); if (avTransService == null) return false; Action action = avTransService.getAction(AVTransport.SETAVTRANSPORTURI); if (action == null) return false; action.setArgumentValue(AVTransport.INSTANCEID, "0"); action.setArgumentValue(AVTransport.CURRENTURI, resURL); action.setArgumentValue(AVTransport.CURRENTURIMETADATA, ""); return action.postControlAction(); }
public boolean setAVTransportURI( Device dev, ItemNode itemNode) { if (dev == null) return false; ResourceNode resNode = itemNode.getFirstResource(); if (resNode == null) return false; String resURL = resNode.getURL(); if (resURL == null || resURL.length() <= 0) return false; Service avTransService = dev.getService(AVTransport.SERVICE_TYPE); if (avTransService == null) return false; Action action = avTransService.getAction(AVTransport.SETAVTRANSPORTURI); if (action == null) return false; action.setArgumentValue(AVTransport.INSTANCEID, "0"); action.setArgumentValue(AVTransport.CURRENTURI, resURL); action.setArgumentValue(AVTransport.CURRENTURIMETADATA, ""); return action.postControlAction(); }
public static MediaItem create(ItemNode node){ MediaItem item = new MediaItem(); item.setStringid(node.getID()); item.setTitle(node.getTitle()); item.setObjectClass(node.getUPnPClass()); item.setDate(node.getDateTime()); item.setAlbum(node.getAlbum()); item.setAlbumUri(node.getAlbumArtURI()); item.setArtist(node.getArtist()); ResourceNode resourceNode = node.getFirstResource(); if (resourceNode != null){ item.setRes(resourceNode.getURL()); item.setprotocolInfo(resourceNode.getProtocolInfo()); item.setDuration(DlnaUtil.formatDurationString(resourceNode.getDuration())); item.setSize(DlnaUtil.formatSizeString(resourceNode.getSize())); } return item; } }