Reputation: 7976
I'm working with MediaResponse
to play media (play song) with Google Actions V2
.
I did these features:
Play audio
Stop
Pause
Resume
Play
Next
Previous
Repeat
But I wonder that why MediaResponse
did not support Volume intergration
while I said
Increase|Decrease Volume
Volume Up|Down
Is there anyway for me to implement these features?
p/s :
- Spotify service can did it.
- I able to detect Intent with specify phrases : "Volume Up" ...
MediaResponse.js
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 = function (song, mediaResponse) {
this.song = song;
this.mediaResponse = mediaResponse;
}
// Media Response : Play audio
return new Media(song, mediaResponse);
}
playSong(conv, song) {
console.log("playSong() " + song.title + " --- " + song.url);
var media = function (song, mediaResponse) {
this.song = song;
this.mediaResponse = mediaResponse;
}
media = this.getMediaResponse(song);
// 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',
'volumeDown',
'volumeUp'));
conv.ask(new SimpleResponse(""));
};
}
Upvotes: 3
Views: 240
Reputation: 7976
After file a query to Google,
They answered that this time does not support.
It should be release in close future.
Upvotes: 0
Reputation: 384
Actions on Google doesn't, under normal conditions, allow for programatic control of volume. The reason you see it in Spotify is probably because Google and Spotify have a special relationship that lets them get around some of the normal constraints.
Upvotes: 1