Created
January 5, 2021 07:50
-
-
Save kinisoftware/cc19d75475b623cbfe676cb6517ce28b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PlaybackFailureHandler : RequestHandler { | |
override fun canHandle(input: HandlerInput) = | |
input.matches(Predicates.requestType(PlaybackFailedRequest::class.java)) | |
override fun handle(input: HandlerInput): Optional<Response> { | |
val request = input.requestEnvelope.request | |
val intentRequest = request as PlaybackFailedRequest | |
return when (intentRequest.error.type) { | |
ErrorType.MEDIA_ERROR_INTERNAL_DEVICE_ERROR -> input.responseBuilder.build() | |
else -> PlayAudioResponseBuilder.buildFallbackResponse(input) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment