You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So using the 1.4.0 new version of the sdk, I can't seem to get audioplayer state if I make an intent called pausePlayback - I need the audio player state to find out where the current playback is in ms to store where they were at, so you can resume from that point.
There weren't any example but I was able to glean what should work like so:
private AudioPlayerState getAudioPlayerState(Context context) {
def playerState = context.getState(AudioPlayerInterface.class, AudioPlayerState.class)
log.debug("playerState=${playerState)}")
return playerState
}
So calling this from onIntent with the requestenvelope context. Is this the right way to get this state? I know this state is passed in because I have a working fork of the sdk where I read that information and I can access it. To get an audio skill certified you must support the pause and resume playback functions so a user would need this to work.
The text was updated successfully, but these errors were encountered:
For me it would be natural to get the current playback position in onPlaybackStopped whose envelope has offsetInMilliseconds inside of PlaybackStoppedRequest. It however did not work for me the session is NULL in onPlaybackStopped so I can not persist the offset for the user because I there's no user/id in onPlaybackStopped. It is very confusing if I do not miss something extremely obvious...
Guys, could you please describe the recommended way to get playback offset in order to persist it for the user?
In our 2.0.x major version of SDK, you can access them through AudioPlayer interface with a method called 'getOffsetInMilliseconds()'. This is my implementation of PauseIntentHandler when I was writing an audioplayer skill that handles AMAZON.PauseIntent.
public class PauseIntentHandler implements RequestHandler {
@Override
public boolean canHandle(HandlerInput input) {
return input.matches(intentName("AMAZON.PauseIntent"));
}
@Override
public Optional<Response> handle(HandlerInput input) {
input.getAttributesManager().getPersistentAttributes().put("offset", input.getRequestEnvelope().getContext().getAudioPlayer().getOffsetInMilliseconds());
input.getAttributesManager().savePersistentAttributes();
return input.getResponseBuilder()
.addAudioPlayerStopDirective()
.withShouldEndSession(true)
.build();
}
}
So using the 1.4.0 new version of the sdk, I can't seem to get audioplayer state if I make an intent called pausePlayback - I need the audio player state to find out where the current playback is in ms to store where they were at, so you can resume from that point.
There weren't any example but I was able to glean what should work like so:
private AudioPlayerState getAudioPlayerState(Context context) {
def playerState = context.getState(AudioPlayerInterface.class, AudioPlayerState.class)
log.debug("playerState=${playerState)}")
return playerState
}
So calling this from onIntent with the requestenvelope context. Is this the right way to get this state? I know this state is passed in because I have a working fork of the sdk where I read that information and I can access it. To get an audio skill certified you must support the pause and resume playback functions so a user would need this to work.
The text was updated successfully, but these errors were encountered: