org.fourthline.cling.support.avtransport.callback.Play Java Examples

The following examples show how to use org.fourthline.cling.support.avtransport.callback.Play. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlaybackCommand.java    From BeyondUPnP with Apache License 2.0 6 votes vote down vote up
public static void play() {
    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 Play(avtService) {
            @Override
            public void success(ActionInvocation invocation) {
                Log.i(TAG, "Play success.");
            }

            @Override
            public void failure(ActionInvocation arg0, UpnpResponse arg1, String arg2) {
                Log.e(TAG, "Play failed");
            }
        });
    }
}
 
Example #2
Source File: DLNAController.java    From Popeens-DSub with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void start() {
	if(error) {
		Log.w(TAG, "Attempting to restart song");
		startSong(downloadService.getCurrentPlaying(), true, 0);
		return;
	}

	try {
		controlPoint.execute(new Play(getTransportService()) {
			@Override
			public void success(ActionInvocation invocation) {
				lastUpdate.set(System.currentTimeMillis());
				downloadService.setPlayerState(PlayerState.STARTED);
			}

			@Override
			public void failure(ActionInvocation actionInvocation, UpnpResponse upnpResponse, String msg) {
				Log.w(TAG, "Failed to start playing: " + msg);
				failedLoad();
			}
		});
	} catch(Exception e) {
		Log.w(TAG, "Failed to start", e);
	}
}