use of org.fourthline.cling.model.meta.Device in project BeyondUPnP by kevinshine.
the class PlaybackCommand method pause.
public static void pause() {
Device device = SystemManager.getInstance().getSelectedDevice();
//Check selected device
if (device == null)
return;
Service avtService = device.findService(SystemManager.AV_TRANSPORT_SERVICE);
if (avtService != null) {
ControlPoint cp = SystemManager.getInstance().getControlPoint();
cp.execute(new Pause(avtService) {
@Override
public void success(ActionInvocation invocation) {
Log.i(TAG, "Pause success.");
}
@Override
public void failure(ActionInvocation arg0, UpnpResponse arg1, String arg2) {
Log.e(TAG, "Pause failed");
}
});
}
}
use of org.fourthline.cling.model.meta.Device in project BeyondUPnP by kevinshine.
the class PlaybackCommand method seek.
/**
* Seek
* seek完成后通过handler重新启动position同步线程
*
* @param relativeTimeTarget 要seek到的值,该值为已播放的相对时间如:01:15:03
* @param handler
*/
public static void seek(String relativeTimeTarget, final Handler handler) {
Device device = SystemManager.getInstance().getSelectedDevice();
//Check selected device
if (device == null)
return;
Service avtService = device.findService(SystemManager.AV_TRANSPORT_SERVICE);
if (avtService != null) {
ControlPoint cp = SystemManager.getInstance().getControlPoint();
cp.execute(new Seek(avtService, relativeTimeTarget) {
@Override
public void success(ActionInvocation invocation) {
Log.i(TAG, "Seek success.");
//Delay 1 second to synchronize remote device rel_time and SeekBar progress value.
handler.postDelayed(new Runnable() {
@Override
public void run() {
handler.sendEmptyMessage(NowplayingFragment.RESUME_SEEKBAR_ACTION);
}
}, 1000);
}
@Override
public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMsg) {
Log.e(TAG, "Seek failed");
}
});
}
}
use of org.fourthline.cling.model.meta.Device in project BeyondUPnP by kevinshine.
the class PlaybackCommand method setVolume.
public static void setVolume(int newVolume) {
Device device = SystemManager.getInstance().getSelectedDevice();
//Check selected device
if (device == null)
return;
Service rcService = device.findService(SystemManager.RENDERING_CONTROL_SERVICE);
if (rcService != null) {
ControlPoint cp = SystemManager.getInstance().getControlPoint();
cp.execute(new SetVolume(rcService, newVolume) {
@Override
public void success(ActionInvocation invocation) {
Log.i(TAG, "SetVolume success.");
}
@Override
public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMsg) {
Log.e(TAG, "SetVolume failure.");
}
});
}
}
Aggregations