use of org.fourthline.cling.support.avtransport.callback.SetAVTransportURI in project BeyondUPnP by kevinshine.
the class PlaybackCommand method playNewItem.
public static void playNewItem(final String uri, final String metadata) {
Device device = SystemManager.getInstance().getSelectedDevice();
//Check selected device
if (device == null)
return;
final Service avtService = device.findService(SystemManager.AV_TRANSPORT_SERVICE);
if (avtService != null) {
final ControlPoint cp = SystemManager.getInstance().getControlPoint();
cp.execute(new Stop(avtService) {
@Override
public void success(ActionInvocation invocation) {
cp.execute(new SetAVTransportURI(avtService, uri, metadata) {
@Override
public void success(ActionInvocation invocation) {
//Second,Set Play command.
cp.execute(new Play(avtService) {
@Override
public void success(ActionInvocation invocation) {
Log.i(TAG, "PlayNewItem success:" + uri);
}
@Override
public void failure(ActionInvocation arg0, UpnpResponse arg1, String arg2) {
Log.e(TAG, "playNewItem failed");
}
});
}
@Override
public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMsg) {
}
});
}
@Override
public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMsg) {
}
});
}
}
Aggregations