Google Actions sdk not playing audio in ssml from firebase storage - actions-on-google

Google Actions SDK is unable to play audio files in SSML Audio tag from firebase storage. Although I could play same .ogg format file from wikipedia.
https://upload.wikimedia.org/wikipedia/en/9/9f/Sample_of_%22Another_Day_in_Paradise%22.ogg
firebase file:
https://firebasestorage.googleapis.com/v0/b/assisto-skill.appspot.com/o/TIP103_converted.mp3?alt=media&token=d0d08f9d-e340-478c-af00-657109683136
I'm using it by sending an SSML string that looks like:
<speak>
<audio src='https://firebasestorage.googleapis.com/v0/b/assisto-skill.appspot.com/o/TIP103_converted.mp3?alt=media&token=d0d08f9d-e340-478c-af00-657109683136'>
</audio>
</speak>
But I'm getting the following error:
expected_inputs[0].input_prompt.rich_initial_prompt.items[0].simple_response: 'ssml' could not be parsed.
What could be the reason...Is this a limitation in actions sdk that url needs to be parameter free?

The problem isn't that it can't use parameters - it is that when parsing parameters in URLs that are embedded in SSML it doesn't parse the & separating the parameters the way most HTML parsers parse them these days.
There are a few potential solutions for this, depending on how you can format the URL.
RFC 1866 used to recommend using a ; in place of an &, and some servers allow this. Unfortunately, Firebase Storage is not one of them.
Firebase Storage doesn't require the final token parameter in most cases, so in this case you could omit it, but that isn't a general solution to the problem.
Finally, you could use SGML encoding and replace the & as & (note the leading ampersand and final semicolon). So your SSML would look something like:
<speak>
<audio src='https://firebasestorage.googleapis.com/v0/b/assisto-skill.appspot.com/o/TIP103_converted.mp3?alt=media&token=d0d08f9d-e340-478c-af00-657109683136'>
</audio>
</speak>
This last method is probably the best for general purposes.

Related

Can I upload already-encoded content to azure media services, instead of uploading a video and then encoding it? How?

I want to encode locally and upload to avoid spending money in encoding.
Is this allowed? I did not find any documentation on it.
When I simply uploaded a file to the storage, the media services account said it could not play it without the ISM file. I had to encode (was it re-encode? it was an mp4) the file I had uploaded - I want to avoid that.
Yes, absolutely allowed and encouraged for customers. Especially ones that have custom encoding requirements that we may not support.
You can upload an .ism file that you create along with your encoded files. It's a simple SMIL 2.0 format XML file that points to the source files used.
It's a bit hard to find searching the docs, but there is a section outlining the workflow here - https://learn.microsoft.com/en-us/azure/media-services/latest/encode-dynamic-packaging-concept#on-demand-streaming-workflow
There is also a .NET Sample showing how to do it here:
https://github.com/Azure-Samples/media-services-v3-dotnet/tree/main/Streaming/StreamExistingMp4
You can see the code line at 111 that shows how to generate the .ism file -
// Generate the Server manifest for streaming .ism file.
// This file is a simple SMIL 2.0 file format schema that includes references to the uploaded MP4 files in the XML.
var manifestsList = await AssetUtils.CreateServerManifestsAsync(client, config.ResourceGroup, config.AccountName, inputAsset, locator);

Asterisk AGI Encoding

I’m using a publically available AGI Script that wraps Google’s Speech Recognition API for converting speech to text in Asterisk. Basically, the script passes an audio file do Google and returns the text recognized from the audio.
This is working great, except for one deal breaking problem. Whenever the recognized text contains extended characters such as “á”, “ã”, “é”, etc., the dial plan gets a distorted string. For example, Google returns the text “não”, but ASTERISK gets “não”.
This, obviously, is related to the encoding… But I’m having trouble, due to limited knowledge in AGI and PEARL, determining where the problem. As far as I could determine, it could be
GOOGLE -> PEARL or PEARL -> ASTERISK
I hope someone can help me on this…
Got it!
Used a function called "decode" to decode the response from the Google API.

Looking for a way to output the top viewed youtube video to a text file for a search term

I would like to output just the top youtube video for a particular search term, e.g Tennis to a text file. Command line options are what I prefer but am open to other solutions.
You can fetch the data you need in XML format from YouTube's API.
(Note: The results may differ from the HTML website)
Then parse the XML with anything you want, e.g. Perl's XML::LibXML::XPathContext. It's a bit fiddly though, if you haven't used that module before.
Once you have the video URL, you can pass it to youtube-dl.

Streaming and playing an MP3 stream. .mp3 URL format

I used the sample code from http://cocoawithlove.com/2008/09/streaming-and-playing-live-mp3-stream.html. it runs OK with default URL. But when I replace with my URL "http://dl.mp3.kapsule.info/fsfsdfdsfdserwrwq3/fc90613208cc3f16ae6d6ba05d21880c/4b5244f0/b/7e/b7e80afa18d06fdd3dd9f9fa44b51fc0.mp3?filename=Every-Day-I-Love-You.mp3", this app shows an message as "Audio not Found". But when I put my URL on Address Bar of Web Browser, I can download this .mp3 file.
really, I can't understand why it is?
pleased tell me!
Thank you very much
My guess would be that the app is designed to play a MP3 encoded audio stream with no limit in length (which is different from your ordinary music file). To set this up, you need a streaming server on the client side.
I think you can find out for sure by trying with a different radio station that transmits in MP3. If that works, it's most likely that your app doesn't like your file.
You should, as Vivek recommends, also try using a simpler download URL for your file, in case the App gets confused by the URL's length and/or structure.
As mentioned, this is due to the URL of the file. The AudioStreamer code specifically checks for the extension of the file and tries to figure out the audio type based on that. If you change that logic to handle your custom URLs, it will start working
So to point you in the right direction: open AudioStreamer.m and look for the references of
hintForFileExtension:
This function returns the type of file based on the extension. If you know the file type won't change (always mp3), the quick and dirty solution is to always assign mp3 type without any logic... like this:
err = AudioFileStreamOpen(self, MyPropertyListenerProc, MyPacketsProc, kAudioFileMP3Type, &audioFileStream);
Note: I've put kAudioFileMP3Type constant instead of calculated value
PS yes, it does work with static mp3 files, even though it's designed for streams and hence misses some of the functionality one would expect from a player that plays a static file on the server (caching, prefetching, proper seeking)
Thats because the default url directly points to a file in the webserver, whereas the the url you've mentioned is a HTTP (POST/GET) operation, which the application may not be designed to handle.
I suspect that your URL is one-time-use. When I try to visit it, I see 408 - Request Timeout.
Many links on mass file sharing websites are like this. If you could download the file directly, you wouldn't sit through a page of ads and premium account offers.
Try again with a file on a normal website, like this one.

List Out all video from url

I am trying to list out all Video from a url. For this i m sending an request to "You Tube"
url as "http://www.youtube.com/" and want to list out all available video . But i didn't get anything from that request ? any idea or any documentation hint ?
There are utilities for downloading youtube videos (for example Linux has youtube-dl), but it's not uncommon for sites with large numbers of downloadable files to prevent attempts to simply download everything - and even though you said you wanted to list rather than download all the videos, that's unfortunately what it would suggest to a website administrator.
Besides, files on youtube are not accessed by simple urls like http://www.youtube.com/filename
Something more is required. I don't think you can treat the (what is it?) 11 character alphabet soup as a filename, it's a parameter passed to the software which streams back the video.
EDIT: youtube-dl is a command-line program in Linux and probably BSD. You need to know the URL of the Youtube video so you can type (for example)
youtube-dl http://www.youtube.com/watch?v=Z1JZ9O15280
If you had a list of these URLs you could put them in a file and make a bulk download script - but that takes us back to your original question.
In Firefox I would right-click on a link to a Youtube video and choose 'copy link location'. Then paste the URLs one at a time into a text file. But this question is drifting away from mere programming...