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


Java PListParser类代码示例

本文整理汇总了Java中com.connectsdk.service.airplay.PListParser的典型用法代码示例。如果您正苦于以下问题:Java PListParser类的具体用法?Java PListParser怎么用?Java PListParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getPlayState

import com.connectsdk.service.airplay.PListParser; //导入依赖的package包/类
/**
 * AirPlay has the same response for Buffering and Finished states that's why this method
 * always returns Finished state for video which is not ready to play.
 * @param listener
 */
@Override
public void getPlayState(final PlayStateListener listener) {
    getPlaybackInfo(new ResponseListener<Object>() {

        @Override
        public void onSuccess(Object object) {
            PlayStateStatus playState = PlayStateStatus.Unknown;
            try {
                JSONObject response = new PListParser().parse(object.toString());
                if (!response.has("rate")) {
                    playState = PlayStateStatus.Finished;
                } else {
                    int rate = response.getInt("rate");
                    if (rate == 0) {
                        playState = PlayStateStatus.Paused;
                    } else if (rate == 1) {
                        playState = PlayStateStatus.Playing;
                    }
                }
                Util.postSuccess(listener, playState);
            } catch (Exception e) {
                Util.postError(listener, new ServiceCommandError(500, e.getMessage(), null));
            }
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    });
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:37,代码来源:AirPlayService.java

示例2: getPlayState

import com.connectsdk.service.airplay.PListParser; //导入依赖的package包/类
@Override
public void getPlayState(final PlayStateListener listener) {
    getPlaybackInfo(new ResponseListener<Object>() {

        @Override
        public void onSuccess(Object object) {
            PlayStateStatus playState = PlayStateStatus.Unknown;
            try {
                JSONObject response = new PListParser().parse(object.toString());
                if (!response.has("rate")) {
                    playState = PlayStateStatus.Finished;
                } else {
                    int rate = response.getInt("rate");
                    if (rate == 0) {
                        playState = PlayStateStatus.Paused;
                    } else if (rate == 1) {
                        playState = PlayStateStatus.Playing;
                    }
                }
                Util.postSuccess(listener, playState);
            } catch (Exception e) {
                Util.postError(listener, new ServiceCommandError(500, e.getMessage(), null));
            }
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    });
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:32,代码来源:AirPlayService.java


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