org.fourthline.cling.support.model.SeekMode Java Examples

The following examples show how to use org.fourthline.cling.support.model.SeekMode. 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: DLNAController.java    From Popeens-DSub with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void changePosition(int seconds) {
	SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");
	df.setTimeZone(TimeZone.getTimeZone("UTC"));
	controlPoint.execute(new Seek(getTransportService(), SeekMode.REL_TIME, df.format(new Date(seconds * 1000))) {
		@SuppressWarnings("rawtypes")
		@Override
		public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMessage) {
			Log.w(TAG, "Seek failed: " + defaultMessage);
		}
	});
}
 
Example #2
Source File: AVTransportService.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@Override
    public void seek(UnsignedIntegerFourBytes instanceId, String unit, String target) throws AVTransportException {
        final ZxtMediaPlayer player = getInstance(instanceId);
        SeekMode seekMode;
        try {
            seekMode = SeekMode.valueOrExceptionOf(unit);

            if (!seekMode.equals(SeekMode.REL_TIME)) {
                throw new IllegalArgumentException();
            }

//            final ClockTime ct = ClockTime.fromSeconds(ModelUtil.fromTimeString(target));
            int pos = (int) (Utils.getRealTime(target) * 1000);
            Log.i(TAG,"### " + unit + " target: "+ target +"  pos: " + pos);

//            if (getInstance(instanceId).getCurrentTransportInfo().getCurrentTransportState()
//                    .equals(TransportState.PLAYING)) {
//                getInstance(instanceId).pause();
//                getInstance(instanceId).seek(pos);
//                getInstance(instanceId).play();
//            } else if (getInstance(instanceId).getCurrentTransportInfo().getCurrentTransportState()
//                    .equals(TransportState.PAUSED_PLAYBACK)) {
                getInstance(instanceId).seek(pos);
//            }

        } catch (IllegalArgumentException ex) {
            throw new AVTransportException(
                    AVTransportErrorCode.SEEKMODE_NOT_SUPPORTED, "Unsupported seek mode: " + unit
            );
        }
    }
 
Example #3
Source File: AVTransportService.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
@Override
    public void seek(UnsignedIntegerFourBytes instanceId, String unit, String target) throws AVTransportException {
        final ZxtMediaPlayer player = getInstance(instanceId);
        SeekMode seekMode;
        try {
            seekMode = SeekMode.valueOrExceptionOf(unit);

            if (!seekMode.equals(SeekMode.REL_TIME)) {
                throw new IllegalArgumentException();
            }

//            final ClockTime ct = ClockTime.fromSeconds(ModelUtil.fromTimeString(target));
            int pos = (int) (Utils.getRealTime(target) * 1000);
            Log.i(TAG,"### " + unit + " target: "+ target +"  pos: " + pos);

//            if (getInstance(instanceId).getCurrentTransportInfo().getCurrentTransportState()
//                    .equals(TransportState.PLAYING)) {
//                getInstance(instanceId).pause();
//                getInstance(instanceId).seek(pos);
//                getInstance(instanceId).play();
//            } else if (getInstance(instanceId).getCurrentTransportInfo().getCurrentTransportState()
//                    .equals(TransportState.PAUSED_PLAYBACK)) {
                getInstance(instanceId).seek(pos);
//            }

        } catch (IllegalArgumentException ex) {
            throw new AVTransportException(
                    AVTransportErrorCode.SEEKMODE_NOT_SUPPORTED, "Unsupported seek mode: " + unit
            );
        }
    }
 
Example #4
Source File: Seek.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public Seek(Service service, String relativeTimeTarget) {
    this(new UnsignedIntegerFourBytes(0), service, SeekMode.REL_TIME, relativeTimeTarget);
}
 
Example #5
Source File: Seek.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public Seek(UnsignedIntegerFourBytes instanceId, Service service, SeekMode mode, String target) {
    super(new ActionInvocation(service.getAction("Seek")));
    getActionInvocation().setInput("InstanceID", instanceId);
    getActionInvocation().setInput("Unit", mode.name());
    getActionInvocation().setInput("Target", target);
}
 
Example #6
Source File: Seek.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public Seek(Service service, SeekMode mode, String target) {
    this(new UnsignedIntegerFourBytes(0), service, mode, target);
}
 
Example #7
Source File: Seek.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public Seek(UnsignedIntegerFourBytes instanceId, Service service, String relativeTimeTarget) {
    this(instanceId, service, SeekMode.REL_TIME, relativeTimeTarget);
}
 
Example #8
Source File: Seek.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public Seek(Service service, String relativeTimeTarget) {
    this(new UnsignedIntegerFourBytes(0), service, SeekMode.REL_TIME, relativeTimeTarget);
}
 
Example #9
Source File: Seek.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public Seek(UnsignedIntegerFourBytes instanceId, Service service, SeekMode mode, String target) {
    super(new ActionInvocation(service.getAction("Seek")));
    getActionInvocation().setInput("InstanceID", instanceId);
    getActionInvocation().setInput("Unit", mode.name());
    getActionInvocation().setInput("Target", target);
}
 
Example #10
Source File: Seek.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public Seek(Service service, SeekMode mode, String target) {
    this(new UnsignedIntegerFourBytes(0), service, mode, target);
}
 
Example #11
Source File: Seek.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public Seek(UnsignedIntegerFourBytes instanceId, Service service, String relativeTimeTarget) {
    this(instanceId, service, SeekMode.REL_TIME, relativeTimeTarget);
}
 
Example #12
Source File: Playing.java    From TVRemoteIME with GNU General Public License v2.0 votes vote down vote up
public abstract Class<? extends AbstractState> seek(SeekMode unit, String target); 
Example #13
Source File: Stopped.java    From TVRemoteIME with GNU General Public License v2.0 votes vote down vote up
public abstract Class<? extends AbstractState> seek(SeekMode unit, String target); 
Example #14
Source File: AVTransportStateMachine.java    From TVRemoteIME with GNU General Public License v2.0 votes vote down vote up
public abstract void seek(SeekMode unit, String target); 
Example #15
Source File: AVTransportStateMachine.java    From DroidDLNA with GNU General Public License v3.0 votes vote down vote up
public abstract void seek(SeekMode unit, String target); 
Example #16
Source File: Stopped.java    From DroidDLNA with GNU General Public License v3.0 votes vote down vote up
public abstract Class<? extends AbstractState> seek(SeekMode unit, String target); 
Example #17
Source File: Playing.java    From DroidDLNA with GNU General Public License v3.0 votes vote down vote up
public abstract Class<? extends AbstractState> seek(SeekMode unit, String target);