Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added handling for responseType 'LOAD_CANCELLED' #131

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/java/su/litvak/chromecast/api/v2/Channel.java
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,10 @@ private <T extends Response> T send(String namespace, Request message, String de
if (response instanceof StandardResponse.Invalid) {
StandardResponse.Invalid invalid = (StandardResponse.Invalid) response;
throw new ChromeCastException("Invalid request: " + invalid.reason);
} else if (response instanceof StandardResponse.LoadCancelled) {
throw new ChromeCastException("Unable to load media: Load cancelled");
} else if (response instanceof StandardResponse.LoadFailed) {
throw new ChromeCastException("Unable to load media");
throw new ChromeCastException("Unable to load media: Load failed");
} else if (response instanceof StandardResponse.LaunchError) {
StandardResponse.LaunchError launchError = (StandardResponse.LaunchError) response;
throw new ChromeCastException("Application launch error: " + launchError.reason);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@JsonSubTypes.Type(name = "MEDIA_STATUS", value = StandardResponse.MediaStatus.class),
@JsonSubTypes.Type(name = "MULTIZONE_STATUS", value = StandardResponse.MultizoneStatus.class),
@JsonSubTypes.Type(name = "CLOSE", value = StandardResponse.Close.class),
@JsonSubTypes.Type(name = "LOAD_CANCELLED", value = StandardResponse.LoadCancelled.class),
@JsonSubTypes.Type(name = "LOAD_FAILED", value = StandardResponse.LoadFailed.class),
@JsonSubTypes.Type(name = "LAUNCH_ERROR", value = StandardResponse.LaunchError.class),
@JsonSubTypes.Type(name = "DEVICE_ADDED", value = StandardResponse.DeviceAdded.class),
Expand Down Expand Up @@ -66,6 +67,11 @@ static class Pong extends StandardResponse {}
*/
static class Close extends StandardResponse {}

/**
* Identifies that loading of media has been cancelled.
*/
static class LoadCancelled extends StandardResponse {}

/**
* Identifies that loading of media has failed.
*/
Expand Down