How do I obtain a list of audio formats that the current browser can decode via the web audio API? - web-audio-api

I'm using the web audio javascript API? If I loop through several popular audio formats, and then call document.getElementById('someAudioTag').canPlayType('audio/ogg'); for each format (in this case, ogg), do I get a list of audio formats that I can feed into decodeAudioData?
Is there a more straightforward method to get the list of supported formats via the web audio API?

That's pretty much the only way, I think, aside from incorporating a table like this one (note that that's the formats supported by <audio> and <video> tags, which is not quite the same as supported by the Web Audio API; for example IE doesn't have Web Audio at all yet).
You're likely to get a result of "maybe" on a lot of formats, at least if you don't specify a codec (and I haven't figured out exactly how to specify a codec yet-- I hope someone else can chime in).

WebAudio does not provide any way to determine what formats are supported by decodeAudioData.

Related

How to determine if dialogflow source is text or audio?

I want to distinguish my bot's Alexa and Google Home experience from text-based bots. Text-based bots support Rich Response types, but audio ones do not.
My problem is that I can't find a field in the Dialogflow V2beta1 API docs that specifies text source from audio. It looks like in V1 there was a message field that used a numeric enum to indicate this, but I can't find a V2Beta1 equivalent.
With Actions on Google, instead of checking the input type of the source query, you can check the surface capabilties, which will allow you to see whether the device has a screen or not.

iPhone - Sending comments, images, and/or video to website using JSON

I need to be able to pull comments/images/video down from a website and allow the user's comments/images/videos to be pushed to the website. I am pretty sure JSON can be used to do this for text, but I'm not sure if it can be used for images/video.
Can it?
JSON only supports a few simple data types (strings, booleans, numbers). In order to include more rich media formats, you'd have to determine how to serialize them into this simple data types.
Consider parsing them down into a data URI, or hosting them elsewhere, and linking back to them via a URL.
This SO post has information on how to convert a UIImage into a data URI.
You could also use NSData's initializers to get the raw data of a video resource.
You can but as the other poster stated this is not good idea, get the Image URLs via JSON.
For uploading you want to use POST so you can stream data directly. This saves the serialization and memory when uploading large files. look at: AFNetworking Uploading a file

Why RTMP streaming protocal's url path different from each other?

Recently I'm doing some work on RTMP streaming, that is using Flowplayer to integrate with Edgecast Streaming service and CloudFront Streaming service.
The basic concept is easy to follow, but the format of different providers really waste me a lot of time to figure out.
For example, in order to make edgecast happy, according to the documentation, you need to specify filename in the format of mp4:filename.mp4, flv:filename (without .flv extension) and mp3:filename (without .mp3 extension).
But for CloudFront, it's a different story that mp4:filename.mp4, filename (no flv:prefix, and no .flv extension) and mp3:filename (without .mp3 extension).
This format makes people even more frustrating when today I try to use Edgecast's loadToEdge function, the format the accept is filename.mp4 (without mp4: prefix), filename.flv (without flv: prefix) and mp3:filename.mp3.
As you can see, basically there is no logic there and you have to guess and try all different combinations to make it finally working.
I just would like to know if anyone has idea about why different providers implement their streaming in all customized way? Or is it Adobe's fault doesn't have a unified form or it's just up to service providers to use whatever they like.
Thank you!
It's all about implementation. The URL format, including extensions, has nothing to do with
As an analogy, your question is like asking "Why do some websites have different URLs than others?" Example of two different yet viable ways of serving up an image:
http://server.com/question/87/why/65.png
http://server.com/image/question?number=87&image=65.
It's all about how the coders at EdgeCast, Amazon, et al wanted to implement their CDN. I'm sure there was some logic to it, well thought out or not. And probably some need to deal with legacy systems, clients and URLs.
It has nothing to do with FMS itself. Just like the above analogy's URLs have nothing to do with the web server they are served from.

load videos to play on iPhone from MySQL using php Webservice

Can any one please guide me on this . I am new to iphone/ipad programming.I store videos on my webserver (apache/php).I need to write code for an ipad app to get the videos list for a selected user and play those videos on the ipad/iphone using a php webservice.I was not able to get going on this.Please can anybody share any related links or shower your thoughts on this ? Any help would be highly appreciated.
Thanks
your question actually involves a lot to implement, but I'm not sure where you're right now:
Sever-side programming to expose web-service which can be invoked to
get a list of available videos. Have you done this? And what format
your server-side responses, SOAP XML or JSON?
From your iOS client side, you firstly need to establish an HTTP
request to the web-service URL entry. Have you done that? You may
want to use ASIHTTPRequest to save your effort.
Once you've got server response, depending on how the data is
presented, you may need to find a XML parser or a JSON parser to
parse the raw response.
Then you need to either download the video entirely before playback,
or stream the playback. You may again need ASIHTTPRequest for
downloading. You may need MPMoviePlayerViewController or
MPMoviePlayerController(if you want more control over the player layout) to plackback/stream the video, see:
MPMoviePlayerController and HTTP Live Streaming
And don't forget to save the playlist and user viewing history if
you want to provide a smooth user experience. You may use as simple
as NSUserDefaults/plist as the data persistence media, or as complex
as SQLite database or Core Data.
I suggest you to break down your ultimate goal into specific tasks, and tackle them one by one.
Program your web server to return a JSON object with the list of
movies. You can include preview thumbnails etc.
Include one of the JSON frameworks available (just do a quick
search, there are plenty).
Use the data from the JSON feed to display your list.
When the user clicks on an item, launch a view controller with a
UIWebView to display your movies.
If you do not know how to do any of these things, you should consider an objective-C programming tutorial first.

iPhone: Looking for an API to store survey results

In my iPhone app I am trying to gather feedback on my game via an optional survey. I would like to send this data to a central server, where I could gather all the statistics and process them to have a bar chart or other convenient presentation.
The data being sent an integer representing the user's preference. ie) Given "How did you like our game?", the user could select from a button from :) :\ :( . Eventually I would also like to have audio feedback where the user could record their voice. The variable length sound clip would be sent and stored from an iPhone to some server, for playback later.
Has anybody done something similar? Google Spreadsheets offers an API which I can't make heads nor tails of but I think it will support a tally of responses. ie) I received 10 goods, 4 neutral, and 7 poor ratings. As far as I can tell I wouldn't be able to store a sound clip in a spreadsheet.
I also looked into Google App engine but if possible I'd like to avoid the networking code to transmit the survey data and the server side scripts to interpret the data. Can somebody recommend a simple API that I could use to store integers for viewing? Ideally I'd like to say something simple like
if (response == "Good") MyGoogleSpreadsheet.MyAppStats.Increment(positiveResponseTallyCell);
Later on I'd just log into Googlespreadsheets and the results would be there for me to read. By the way I don't have to necessarily use a spreadsheet. I just want this to be easy. Bonus points if the API supports the storage and playback of sound but integers will suffice for now.
You can do this with the Flurry API (flurry.com) which lets you specify which custom events to log, and gives you charts and downloadable CSV. Very easy to use:
[FlurryAPI startSession: flurryID];
[FlurryAPI logEvent:#"QUESTION1" withParameters:#"Good"];
Although Flurry is made for general usage statistics gathering, I think it would be a quick and easy way to accomplish what you want.
I know you said you've already taken a look at the Google Spreadsheets API, but you may not have seen the GData Objective-C framework which includes support for reading/writing to and from Google Docs spreadsheets (via the GDataServiceGoogleSpreadsheet class).