Search in sources :

Example 1 with PListBuilder

use of com.connectsdk.service.airplay.PListBuilder in project butter-android by butterproject.

the class AirPlayService method playVideo.

public void playVideo(final String url, String mimeType, String title, String description, String iconSrc, boolean shouldLoop, final LaunchListener listener) {
    ResponseListener<Object> responseListener = new ResponseListener<Object>() {

        @Override
        public void onSuccess(Object response) {
            LaunchSession launchSession = new LaunchSession();
            launchSession.setService(AirPlayService.this);
            launchSession.setSessionType(LaunchSessionType.Media);
            Util.postSuccess(listener, new MediaLaunchObject(launchSession, AirPlayService.this));
            startTimer();
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    };
    String uri = getRequestURL("play");
    String payload = null;
    PListBuilder builder = new PListBuilder();
    builder.putString("Content-Location", url);
    builder.putReal("Start-Position", 0);
    payload = builder.toString();
    ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, uri, payload, responseListener);
    request.send();
}
Also used : LaunchSession(com.connectsdk.service.sessions.LaunchSession) PListBuilder(com.connectsdk.service.airplay.PListBuilder) JSONObject(org.json.JSONObject) ServiceCommandError(com.connectsdk.service.command.ServiceCommandError) ResponseListener(com.connectsdk.service.capability.listeners.ResponseListener) ServiceCommand(com.connectsdk.service.command.ServiceCommand)

Aggregations

PListBuilder (com.connectsdk.service.airplay.PListBuilder)1 ResponseListener (com.connectsdk.service.capability.listeners.ResponseListener)1 ServiceCommand (com.connectsdk.service.command.ServiceCommand)1 ServiceCommandError (com.connectsdk.service.command.ServiceCommandError)1 LaunchSession (com.connectsdk.service.sessions.LaunchSession)1 JSONObject (org.json.JSONObject)1