Media player is playing well on Google Assistant while Simulator is not










0















I implemented simple Media Player on AOG by using MediaResponse



The Media Player can play correctly both side :



  • Actions on Google simulator


  • Google Assistant on Mobile Phone


Then,



While It able to do these features on Google Assistant :



  • Play


  • Pause


  • Stop


  • Resume


Simulator can not do this (as the image, it always ask me again)



I wonder why?



People who know, help me explain?



p/s :



And, what is difference between pause and stop?



On Google Assistant, I saw that they have same feature, it means stop totally similar with pause.



enter image description here



enter image description here



MediaPlayerUtils.js



// Library
const
MediaObject,
MediaResponse,
SimpleResponse,
Suggestions
= require('actions-on-google');

class MediaPlayerUtils

getMediaResponse(song)
// This object used to play Media on Google Home
var mediaResponse = new MediaResponse();
mediaResponse.mediaType = "AUDIO";

var mediaObject = new MediaObject(
url: ""
);

mediaObject.name = song.title;
mediaObject.contentUrl = song.url;

mediaResponse.mediaObjects = ;
mediaResponse.mediaObjects.push(mediaObject);

var Media = require('../model/data/Media');

// Media Response : Play audio
return new Media(song, mediaResponse);


playSong(conv, song)
var media = require('../model/data/Media');
media = this.getMediaResponse(song);

console.log("playSong() " + song.title + " " + song.url);

// Media Response : Play audio
conv.ask(new SimpleResponse(" ")); // Able to set song title before playing song in here
conv.ask(media.mediaResponse);
conv.ask(new Suggestions(
"next",
"back",
"previous",
"play",
"pause",
"resume",
"stop"));
conv.ask(new SimpleResponse(""));
;



module.exports = MediaPlayerUtils;


routes.js



'use strict';


const
dialogflow
= require('actions-on-google');

const assistant = dialogflow( debug: true );

const MediaPlayerUtils = require('./util/MediaPlayerUtils');
const mediaPlayer = new MediaPlayerUtils();

module.exports = function (app)

assistant.intent('Default Fallback Intent', (conv) =>
conv.close("Goodbye");
);

assistant.intent('Default Welcome Intent', (conv) =>
var song =
title: "Test",
url: "https://TEST_URL.mp3"
;

console.log("Default Welcome Intent");

mediaPlayer.playSong(conv, song);
);

module.exports.googleHomeActions = assistant;

app.post('/webhook', assistant);
;


Media.js



var Media = function (song, mediaResponse) 
this.song = song;
this.mediaResponse = mediaResponse;


module.exports = Media;









share|improve this question
























  • Please file a bug: developers.google.com/actions/support

    – Leon Nicholls
    Nov 15 '18 at 16:56











  • I asked them already. As the Docs said : Media responses are supported on Android phones and on Google Home

    – Huy Tower
    Nov 16 '18 at 2:05
















0















I implemented simple Media Player on AOG by using MediaResponse



The Media Player can play correctly both side :



  • Actions on Google simulator


  • Google Assistant on Mobile Phone


Then,



While It able to do these features on Google Assistant :



  • Play


  • Pause


  • Stop


  • Resume


Simulator can not do this (as the image, it always ask me again)



I wonder why?



People who know, help me explain?



p/s :



And, what is difference between pause and stop?



On Google Assistant, I saw that they have same feature, it means stop totally similar with pause.



enter image description here



enter image description here



MediaPlayerUtils.js



// Library
const
MediaObject,
MediaResponse,
SimpleResponse,
Suggestions
= require('actions-on-google');

class MediaPlayerUtils

getMediaResponse(song)
// This object used to play Media on Google Home
var mediaResponse = new MediaResponse();
mediaResponse.mediaType = "AUDIO";

var mediaObject = new MediaObject(
url: ""
);

mediaObject.name = song.title;
mediaObject.contentUrl = song.url;

mediaResponse.mediaObjects = ;
mediaResponse.mediaObjects.push(mediaObject);

var Media = require('../model/data/Media');

// Media Response : Play audio
return new Media(song, mediaResponse);


playSong(conv, song)
var media = require('../model/data/Media');
media = this.getMediaResponse(song);

console.log("playSong() " + song.title + " " + song.url);

// Media Response : Play audio
conv.ask(new SimpleResponse(" ")); // Able to set song title before playing song in here
conv.ask(media.mediaResponse);
conv.ask(new Suggestions(
"next",
"back",
"previous",
"play",
"pause",
"resume",
"stop"));
conv.ask(new SimpleResponse(""));
;



module.exports = MediaPlayerUtils;


routes.js



'use strict';


const
dialogflow
= require('actions-on-google');

const assistant = dialogflow( debug: true );

const MediaPlayerUtils = require('./util/MediaPlayerUtils');
const mediaPlayer = new MediaPlayerUtils();

module.exports = function (app)

assistant.intent('Default Fallback Intent', (conv) =>
conv.close("Goodbye");
);

assistant.intent('Default Welcome Intent', (conv) =>
var song =
title: "Test",
url: "https://TEST_URL.mp3"
;

console.log("Default Welcome Intent");

mediaPlayer.playSong(conv, song);
);

module.exports.googleHomeActions = assistant;

app.post('/webhook', assistant);
;


Media.js



var Media = function (song, mediaResponse) 
this.song = song;
this.mediaResponse = mediaResponse;


module.exports = Media;









share|improve this question
























  • Please file a bug: developers.google.com/actions/support

    – Leon Nicholls
    Nov 15 '18 at 16:56











  • I asked them already. As the Docs said : Media responses are supported on Android phones and on Google Home

    – Huy Tower
    Nov 16 '18 at 2:05














0












0








0








I implemented simple Media Player on AOG by using MediaResponse



The Media Player can play correctly both side :



  • Actions on Google simulator


  • Google Assistant on Mobile Phone


Then,



While It able to do these features on Google Assistant :



  • Play


  • Pause


  • Stop


  • Resume


Simulator can not do this (as the image, it always ask me again)



I wonder why?



People who know, help me explain?



p/s :



And, what is difference between pause and stop?



On Google Assistant, I saw that they have same feature, it means stop totally similar with pause.



enter image description here



enter image description here



MediaPlayerUtils.js



// Library
const
MediaObject,
MediaResponse,
SimpleResponse,
Suggestions
= require('actions-on-google');

class MediaPlayerUtils

getMediaResponse(song)
// This object used to play Media on Google Home
var mediaResponse = new MediaResponse();
mediaResponse.mediaType = "AUDIO";

var mediaObject = new MediaObject(
url: ""
);

mediaObject.name = song.title;
mediaObject.contentUrl = song.url;

mediaResponse.mediaObjects = ;
mediaResponse.mediaObjects.push(mediaObject);

var Media = require('../model/data/Media');

// Media Response : Play audio
return new Media(song, mediaResponse);


playSong(conv, song)
var media = require('../model/data/Media');
media = this.getMediaResponse(song);

console.log("playSong() " + song.title + " " + song.url);

// Media Response : Play audio
conv.ask(new SimpleResponse(" ")); // Able to set song title before playing song in here
conv.ask(media.mediaResponse);
conv.ask(new Suggestions(
"next",
"back",
"previous",
"play",
"pause",
"resume",
"stop"));
conv.ask(new SimpleResponse(""));
;



module.exports = MediaPlayerUtils;


routes.js



'use strict';


const
dialogflow
= require('actions-on-google');

const assistant = dialogflow( debug: true );

const MediaPlayerUtils = require('./util/MediaPlayerUtils');
const mediaPlayer = new MediaPlayerUtils();

module.exports = function (app)

assistant.intent('Default Fallback Intent', (conv) =>
conv.close("Goodbye");
);

assistant.intent('Default Welcome Intent', (conv) =>
var song =
title: "Test",
url: "https://TEST_URL.mp3"
;

console.log("Default Welcome Intent");

mediaPlayer.playSong(conv, song);
);

module.exports.googleHomeActions = assistant;

app.post('/webhook', assistant);
;


Media.js



var Media = function (song, mediaResponse) 
this.song = song;
this.mediaResponse = mediaResponse;


module.exports = Media;









share|improve this question
















I implemented simple Media Player on AOG by using MediaResponse



The Media Player can play correctly both side :



  • Actions on Google simulator


  • Google Assistant on Mobile Phone


Then,



While It able to do these features on Google Assistant :



  • Play


  • Pause


  • Stop


  • Resume


Simulator can not do this (as the image, it always ask me again)



I wonder why?



People who know, help me explain?



p/s :



And, what is difference between pause and stop?



On Google Assistant, I saw that they have same feature, it means stop totally similar with pause.



enter image description here



enter image description here



MediaPlayerUtils.js



// Library
const
MediaObject,
MediaResponse,
SimpleResponse,
Suggestions
= require('actions-on-google');

class MediaPlayerUtils

getMediaResponse(song)
// This object used to play Media on Google Home
var mediaResponse = new MediaResponse();
mediaResponse.mediaType = "AUDIO";

var mediaObject = new MediaObject(
url: ""
);

mediaObject.name = song.title;
mediaObject.contentUrl = song.url;

mediaResponse.mediaObjects = ;
mediaResponse.mediaObjects.push(mediaObject);

var Media = require('../model/data/Media');

// Media Response : Play audio
return new Media(song, mediaResponse);


playSong(conv, song)
var media = require('../model/data/Media');
media = this.getMediaResponse(song);

console.log("playSong() " + song.title + " " + song.url);

// Media Response : Play audio
conv.ask(new SimpleResponse(" ")); // Able to set song title before playing song in here
conv.ask(media.mediaResponse);
conv.ask(new Suggestions(
"next",
"back",
"previous",
"play",
"pause",
"resume",
"stop"));
conv.ask(new SimpleResponse(""));
;



module.exports = MediaPlayerUtils;


routes.js



'use strict';


const
dialogflow
= require('actions-on-google');

const assistant = dialogflow( debug: true );

const MediaPlayerUtils = require('./util/MediaPlayerUtils');
const mediaPlayer = new MediaPlayerUtils();

module.exports = function (app)

assistant.intent('Default Fallback Intent', (conv) =>
conv.close("Goodbye");
);

assistant.intent('Default Welcome Intent', (conv) =>
var song =
title: "Test",
url: "https://TEST_URL.mp3"
;

console.log("Default Welcome Intent");

mediaPlayer.playSong(conv, song);
);

module.exports.googleHomeActions = assistant;

app.post('/webhook', assistant);
;


Media.js



var Media = function (song, mediaResponse) 
this.song = song;
this.mediaResponse = mediaResponse;


module.exports = Media;






node.js dialogflow actions-on-google






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 2:50







Huy Tower

















asked Nov 14 '18 at 2:41









Huy TowerHuy Tower

3,88694072




3,88694072












  • Please file a bug: developers.google.com/actions/support

    – Leon Nicholls
    Nov 15 '18 at 16:56











  • I asked them already. As the Docs said : Media responses are supported on Android phones and on Google Home

    – Huy Tower
    Nov 16 '18 at 2:05


















  • Please file a bug: developers.google.com/actions/support

    – Leon Nicholls
    Nov 15 '18 at 16:56











  • I asked them already. As the Docs said : Media responses are supported on Android phones and on Google Home

    – Huy Tower
    Nov 16 '18 at 2:05

















Please file a bug: developers.google.com/actions/support

– Leon Nicholls
Nov 15 '18 at 16:56





Please file a bug: developers.google.com/actions/support

– Leon Nicholls
Nov 15 '18 at 16:56













I asked them already. As the Docs said : Media responses are supported on Android phones and on Google Home

– Huy Tower
Nov 16 '18 at 2:05






I asked them already. As the Docs said : Media responses are supported on Android phones and on Google Home

– Huy Tower
Nov 16 '18 at 2:05













1 Answer
1






active

oldest

votes


















0














The codes is correct.



But currently as Docs said : Media responses are supported on Android phones and on Google Home






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53292426%2fmedia-player-is-playing-well-on-google-assistant-while-simulator-is-not%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The codes is correct.



    But currently as Docs said : Media responses are supported on Android phones and on Google Home






    share|improve this answer



























      0














      The codes is correct.



      But currently as Docs said : Media responses are supported on Android phones and on Google Home






      share|improve this answer

























        0












        0








        0







        The codes is correct.



        But currently as Docs said : Media responses are supported on Android phones and on Google Home






        share|improve this answer













        The codes is correct.



        But currently as Docs said : Media responses are supported on Android phones and on Google Home







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 16 '18 at 2:06









        Huy TowerHuy Tower

        3,88694072




        3,88694072



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53292426%2fmedia-player-is-playing-well-on-google-assistant-while-simulator-is-not%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Top Tejano songwriter Luis Silva dead of heart attack at 64

            ReactJS Fetched API data displays live - need Data displayed static

            政党