Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

175
Vistas
Coding Issue Alexa SDK

I am trying to finish up my Alexa App for music, but for some reason, the stop and cancel part of my app isn't working. This is my code (part of it):

(the async stop is what is called when controller.stop is called)

const CancelAndStopIntentHandler = {
   canHandle(handlerInput) {
       return (
           Alexa.getRequestType(handlerInput.requestEnvelope) === "IntentRequest" &&
           (Alexa.getIntentName(handlerInput.requestEnvelope) ===
               "AMAZON.CancelIntent" ||
               Alexa.getIntentName(handlerInput.requestEnvelope) ===
               "AMAZON.StopIntent" ||
               Alexa.getIntentName(handlerInput.requestEnvelope) ===
               "AMAZON.PauseIntent")
       );
   },
   handle(handlerInput) {
       console.log("CancelAndStopIntentHandler");
       handlerInput.responseBuilder.speak("Okay")
       return controller.stop(handlerInput, "okay"); //Goodbye!");
   },
};

-------------------------------------------------------------------------
   async stop(handlerInput, message) {
       var device_id = handlerInput.requestEnvelope.context.System.device.deviceId;
       var info = await getstuffindb(device_id);
       console.log(info.length);
       var deviceMap = JSON.parse(info.devicemap);
       deviceMap[device_id]["is_playing"]=false;
       if (deviceMap[device_id]) {
         deviceMap[device_id]["g_offset"] = handlerInput.requestEnvelope.context.AudioPlayer.offsetInMilliseconds;
         console.log('Stopped at offset', deviceMap[device_id]["g_offset"]);
       }
       await insertintodb(device_id, JSON.stringify(deviceMap), device_id);
       return handlerInput.responseBuilder
           .speak(message)
           .withShouldEndSession(true)
           .addAudioPlayerStopDirective()
           .getResponse();
   },

Error image: enter image description here

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda