当前位置: 首页>>代码示例>>Java>>正文


Java Util.postSuccess方法代码示例

本文整理汇总了Java中com.connectsdk.core.Util.postSuccess方法的典型用法代码示例。如果您正苦于以下问题:Java Util.postSuccess方法的具体用法?Java Util.postSuccess怎么用?Java Util.postSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.connectsdk.core.Util的用法示例。


在下文中一共展示了Util.postSuccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: play

import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void play(final ResponseListener<Object> listener) {
    ConnectionListener connectionListener = new ConnectionListener() {

        @Override
        public void onConnected() {
            try {
                mMediaPlayer.play(mApiClient);
                Util.postSuccess(listener, null);
            } catch (Exception e) {
                Util.postError(listener, new ServiceCommandError(0, "Unable to play", null));
            }
        }
    };

    runCommand(connectionListener);
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:18,代码来源:CastService.java

示例2: connect

import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void connect(final ResponseListener<Object> listener) {
    if (castServiceChannel != null) {
        disconnectFromWebApp();
    }

    castServiceChannel = new CastServiceChannel(launchSession.getAppId(), this);

    try {
        Cast.CastApi.setMessageReceivedCallbacks(service.getApiClient(),
                castServiceChannel.getNamespace(),
                castServiceChannel);

        Util.postSuccess(listener, null);
    } catch (IOException e) {
        castServiceChannel = null;

        Util.postError(listener, new ServiceCommandError(0, "Failed to create channel", null));
    }
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:21,代码来源:CastWebAppSession.java

示例3: displayMedia

import com.connectsdk.core.Util; //导入方法依赖的package包/类
private void displayMedia(JSONObject params, final MediaPlayer.LaunchListener listener) {
    String uri = "ssap://media.viewer/open";

    ResponseListener<Object> responseListener = new ResponseListener<Object>() {
        @Override
        public void onSuccess(Object response) {
            JSONObject obj = (JSONObject) response;

            LaunchSession launchSession = LaunchSession.launchSessionForAppId(obj.optString("id"));
            launchSession.setService(WebOSTVService.this);
            launchSession.setSessionId(obj.optString("sessionId"));
            launchSession.setSessionType(LaunchSessionType.Media);

            Util.postSuccess(listener, new MediaLaunchObject(launchSession, WebOSTVService.this));
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    };

    ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, uri, params, true, responseListener);
    request.send();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:26,代码来源:WebOSTVService.java

示例4: getSystemInfo

import com.connectsdk.core.Util; //导入方法依赖的package包/类
public void getSystemInfo(final SystemInfoListener listener) {
    String uri = "ssap://system/getSystemInfo";

    ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, uri, null, true, new ResponseListener<Object>() {

        @Override
        public void onSuccess(Object response) {
            try {
                JSONObject jsonObj = (JSONObject)response;
                JSONObject features = (JSONObject) jsonObj.get("features");
                Util.postSuccess(listener, features);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    });

    request.send();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:25,代码来源:WebOSTVService.java

示例5: launchAppWithInfo

import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void launchAppWithInfo(final AppInfo appInfo, Object params, final AppLaunchListener listener) {
    ServiceCommand<ResponseListener<Object>> command = new ServiceCommand<ResponseListener<Object>>(this, requestURL(appInfo.getName()), params, new ResponseListener<Object>() {
        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, new ServiceCommandError(0, "Problem Launching app", null));
        }

        @Override
        public void onSuccess(Object object) {
            LaunchSession launchSession = LaunchSession.launchSessionForAppId(appInfo.getId());
            launchSession.setAppName(appInfo.getName());
            launchSession.setSessionId((String)object);
            launchSession.setService(DIALService.this);
            launchSession.setSessionType(LaunchSessionType.App);

            Util.postSuccess(listener, launchSession);
        }
    });

    command.send();
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:23,代码来源:DIALService.java

示例6: getLaunchPoints

import com.connectsdk.core.Util; //导入方法依赖的package包/类
public void getLaunchPoints(final LaunchPointsListener listener) {
    String uri = "ssap://com.webos.applicationManager/listLaunchPoints";

    ResponseListener<Object> responseListener = new ResponseListener<Object>() {

        @Override
        public void onSuccess(Object response) {

            try {
                JSONObject jsonObj = (JSONObject) response;
                JSONArray launchPoints = (JSONArray) jsonObj.get("launchPoints");
                Util.postSuccess(listener, launchPoints);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    };

    ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, uri, null, true, responseListener);
    request.send();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:27,代码来源:WebOSTVService.java

示例7: handleMediaCommandResponse

import com.connectsdk.core.Util; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void handleMediaCommandResponse(final JSONObject payload) {
    String requestID = payload.optString("requestId");
    if (requestID.length() == 0)
        return;

    final ServiceCommand<ResponseListener<Object>> command =
            (ServiceCommand<ResponseListener<Object>>) mActiveCommands.get(requestID);

    if (command == null)
        return;

    String mError = payload.optString("error");

    if (mError.length() != 0) {
        Util.postError(command.getResponseListener(), new ServiceCommandError(0, mError, null));
    } else {
        Util.postSuccess(command.getResponseListener(), payload);
    }

    mActiveCommands.remove(requestID);
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:23,代码来源:WebOSWebAppSession.java

示例8: getMediaInfo

import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void getMediaInfo(MediaInfoListener listener) {
    if (mMediaPlayer == null)
        return;

    if (mMediaPlayer.getMediaInfo() != null) {
        String url = mMediaPlayer.getMediaInfo().getContentId();
        String mimeType = mMediaPlayer.getMediaInfo().getContentType();

        MediaMetadata metadata = mMediaPlayer.getMediaInfo().getMetadata();
        String title = null;
        String description = null;
        ArrayList<ImageInfo> list = null;

        if (metadata != null) {
            title = metadata.getString(MediaMetadata.KEY_TITLE);
            description =  metadata.getString(MediaMetadata.KEY_SUBTITLE);

            if (metadata.getImages() != null && metadata.getImages().size() > 0) {
                String iconUrl = metadata.getImages().get(0).getUrl().toString();
                list = new ArrayList<ImageInfo>();
                list.add(new ImageInfo(iconUrl));
            }
        }

        MediaInfo info = new MediaInfo(url, mimeType, title, description, list);

        Util.postSuccess(listener, info);
    }
    else {
        Util.postError(listener, new ServiceCommandError(0, "Media Info is null", null));
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:34,代码来源:CastService.java

示例9: getChannelList

import com.connectsdk.core.Util; //导入方法依赖的package包/类
private ServiceCommand<ResponseListener<Object>> getChannelList(boolean isSubscription, final ChannelListListener listener) {
    ServiceCommand<ResponseListener<Object>> request;

    ResponseListener<Object> responseListener = new ResponseListener<Object>() {

        @Override
        public void onSuccess(Object response) {
            try {
                JSONObject jsonObj = (JSONObject)response;
                ArrayList<ChannelInfo> list = new ArrayList<ChannelInfo>();

                JSONArray array = (JSONArray) jsonObj.get("channelList");
                for (int i = 0; i < array.length(); i++) {
                    JSONObject object = (JSONObject) array.get(i);

                    ChannelInfo channel = parseRawChannelData(object);
                    list.add(channel);
                }

                Util.postSuccess(listener, list);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    };

    if (isSubscription)
        request = new URLServiceSubscription<ResponseListener<Object>>(this, CHANNEL_LIST, null, true, responseListener);
    else
        request = new ServiceCommand<ResponseListener<Object>>(this, CHANNEL_LIST, null, true, responseListener);

    request.send();

    return request;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:41,代码来源:WebOSTVService.java

示例10: playMedia

import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void playMedia(MediaInfo mediaInfo, boolean shouldLoop, final MediaPlayer.LaunchListener listener) {
    if (getDLNAService() != null) {
        final MediaPlayer.LaunchListener launchListener = new LaunchListener() {

            @Override
            public void onError(ServiceCommandError error) {
                if (listener != null)
                    Util.postError(listener, error);
            }

            @Override
            public void onSuccess(MediaLaunchObject object) {
                object.launchSession.setAppId(SMART_SHARE);
                object.launchSession.setAppName(SMART_SHARE);

                object.mediaControl = NetcastTVService.this.getMediaControl();

                if (listener != null)
                    Util.postSuccess(listener, object);
            }
        };

        getDLNAService().playMedia(mediaInfo, shouldLoop, launchListener);
    }
    else {
        System.err.println("DLNA Service is not ready yet");
    }
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:30,代码来源:NetcastTVService.java

示例11: getVolume

import com.connectsdk.core.Util; //导入方法依赖的package包/类
private ServiceCommand<VolumeListener> getVolume(boolean isSubscription, final VolumeListener listener) {
    ServiceCommand<VolumeListener> request;

    ResponseListener<Object> responseListener = new ResponseListener<Object>() {

        @Override
        public void onSuccess(Object response) {

            try {
                JSONObject jsonObj = (JSONObject)response;
                int iVolume = (Integer) jsonObj.get("volume");
                float fVolume = (float) (iVolume / 100.0);

                Util.postSuccess(listener, fVolume);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    };

    if (isSubscription)
        request = new URLServiceSubscription<VolumeListener>(this, VOLUME, null, true, responseListener);
    else
        request = new ServiceCommand<VolumeListener>(this, VOLUME, null, true, responseListener);

    request.send();

    return request;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:35,代码来源:WebOSTVService.java

示例12: sendP2PMessage

import com.connectsdk.core.Util; //导入方法依赖的package包/类
private void sendP2PMessage(final Object message,
        final ResponseListener<Object> listener) {
    JSONObject _payload = new JSONObject();

    try {
        _payload.put("type", "p2p");
        _payload.put("to", getFullAppId());
        _payload.put("payload", message);
    } catch (JSONException ex) {
        // do nothing
    }

    if (isConnected()) {
        socket.sendMessage(_payload, null);

        Util.postSuccess(listener, null);
    } else {
        ResponseListener<Object> connectListener = new ResponseListener<Object>() {

            @Override
            public void onError(ServiceCommandError error) {
                Util.postError(listener, error);
            }

            @Override
            public void onSuccess(Object object) {
                sendP2PMessage(message, listener);
            }
        };

        connect(connectListener);
    }
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:34,代码来源:WebOSWebAppSession.java

示例13: getMute

import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void getMute(final MuteListener listener) {
    String method = "GetMute";
    String instanceId = "0";
    String channel = "Master";

    Map<String, String> params = new LinkedHashMap<String, String>();
    params.put("Channel", channel);

    String payload = getMessageXml(RENDERING_CONTROL_URN, method, instanceId, params);

    ResponseListener<Object> responseListener = new ResponseListener<Object>() {

        @Override
        public void onSuccess(Object response) {
            String currentMute = parseData((String) response, "CurrentMute");
            boolean isMute = Boolean.parseBoolean(currentMute);

            Util.postSuccess(listener, isMute);
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    };

    ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, method, payload, responseListener);
    request.send();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:31,代码来源:DLNAService.java

示例14: playVideo

import com.connectsdk.core.Util; //导入方法依赖的package包/类
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();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:35,代码来源:AirPlayService.java

示例15: getMute

import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void getMute(final MuteListener listener) {
    Util.postSuccess(listener, currentMuteStatus);
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:5,代码来源:CastService.java


注:本文中的com.connectsdk.core.Util.postSuccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。