本文整理汇总了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);
}
});
}
示例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);
}
});
}