Record audio in Google App Engine using rtmplite? - python

I am in the process of building a Google App Engine application which requires audio to be recorded and saved in our database. I have found no alternative to using some form of RTMP server for recording audio through flash, so [rtmplite] (http://code.google.com/p/rtmplite/) came into our horizon.
Since I have no experience with rtmplite, is it the right choice for our project? Or is there any other Python-based RTMP solution that allows audio recording? Any flash client you can recommend?
Thanks!

Google App Engine is tricky for RTMP because it does not support sockets. You would have to use something like RTMPT which is tunneled over HTTP, however, this tunneling incurs latency so if you are looking to do anything realtime this could become an issue.
Currently rtmplite does not support RTMPT so this would not be possible at the moment. I am involved in a project, RTMPy (http://rtmpy.org), that is planning support for RTMPT and AppEngine. Unfortunately AppEngine support is probably a few months out.

Try appengine backends, they currently don't whitelist a lot of things required for such streaming. But they might soon do so. Once they enable sockets, then rtmplite or rtmpy could easily be ported to run there. Backends already support unlimited request length which is required for streaming.

Related

What is apple's preference for connecting ios apps to python code?

I've developed a cool thing in python that does some simple data manipulation and a bit of machine learning stuff based on user inputs. I'd like to develop an ios app for it, and from what I've read, that app should be in swift as much as possible. I'd like to keep the 'brains' of the app in python on a server so I can develop multiple interfaces to it (a website, possibly an android app as well, a chrome/safari extension).
My app could just be a shortcut to the mobile version of the website, but from what I've read, I can make a better product by writing a custom app for ios.
Can anyone point me to resources describing the most apple-approved way of letting a swift app communicate with a server that hosts a python back end?
welcome to StackOverflow!
iOS does not make a distinction whether the server runs PHP, Python, Java, JS/Node or whatever. All you need is network communication. The easiest way to start would be to simply use HTTPS (it needs to be SSL secured, if you do HTTP requests Apple will reject your app in review).
Apple gives you some tools directly in Swift. All you need should be covered by URLSession: https://developer.apple.com/documentation/foundation/urlsession
There is also a nice tutorial on RayWenderlich: https://www.raywenderlich.com/567-urlsession-tutorial-getting-started
Additional comment:
This of course means you will need to make sure your Python code is available via Network/Internet. A good way to host Python code as a server would be Django (https://www.djangoproject.com/)

Pubsub with Google App Engine

I'm trying to implement pubsub messaging with Google App Engine. I want to be able to store callbacks to other servers and then send them new data when it becomes available.
I've had a good look around but can't seem to come up with anything apart from implementing it myself. I've seen pubsubhubbub:
https://code.google.com/p/pubsubhubbub/wiki/DeveloperGettingStartedGuide
but I want to be able to store query parameters. Xmpp xep 60 for example includes capabilities to configure subscriptions with additional data (called options).
The XMPP service in App Engine doesn't seem to have the pubsub extension.
Is managing our own recipient list as:
https://groups.google.com/forum/#!topic/google-appengine/CaBcX0EWO00
seems to suggest the only option?
App Engine seems to have implementations with devices in mind using:
Channels for javascript:
https://developers.google.com/appengine/docs/python/channel/
CloudBackendMessaging for devices:
https://developers.google.com/cloud/samples/mbs/pubsub_messaging
There is a Limited Preview for Google Cloud Pub/Sub which will be something to watch out for as it matures.
Google Cloud Pub/Sub is designed to provide reliable, many-to-many,
asynchronous messaging between applications. Publisher applications
can send messages to a “topic” and other applications can subscribe to
that topic to receive the messages. By decoupling senders and
receivers, Google Cloud Pub/Sub allows developers to communicate
between independently written applications.
There are no client-originated persistent connections (i.e. a listening socket) on AppEngine, so it's quite impossible to implement a real-time push system on it.
As you already know, you can get close with Channels API (solving push to browsers) and mobile device-specific push systems (GCM and APNS).
If you want a universal system, I'd recommend a socket based system, much like PubNub. You should look into Compute Engine which allows for such functionality.

Long Polling System on Server side

I need a sort of consultation. I am building a web app in django(hosted in heroku) which need to communicate with 100 of embedded devices(writing in C++/C). The embedded devices send data(50kb) to the web app and the web app present this information in a form of graphs.
My concern is , is it wise to build a python polling system(Socket communication) in the server side ?
Or is it Error-prone and I should use services like CloudMQTT?
Thank you in advance for your answers.
Unless you wanna have another project on your hands, it'd be best to use a dedicated library.
This isn't python specific, but I feel like you could achieve your goal relatively easy with a simple ajax request.
Check out The WebSocket API.
EDIT:
Upon further reading I found the Python port of websockets

What Python Web Framework should I use with GWT to stream KML from Python Back-end?

I have a long-running process written in Python 2.7 that I would like to send KML files to my GWT application asynchronously as the KML files are generated.
I have been trying to determine what Python web framework I could use as the back-end with the Python process that could possibly allow the webapp to be hosted on Google AppEngine.
I was able to write a simple python webserver using Cherrypy that sent the kml using JSON from the back-end to GWT using an http request; however, I would like the files to be sent to GWT as they are generated since it may be several minutes between each one. What would be a relatively simple but effective way to achieve this? (Comet? Long-polling? Websockets?)
After researching more python web frameworks, I started experimenting with Tornado because it is non-blocking and seems like it could return data as it is generated possibly using long-polling as mentioned in this answer. However, it looks like GAE requires WSGI which would not allow a Tornado webserver to be non-blocking.
I have read answers to similar questions such as this one. However, I am not sure if updates in web frameworks, GWT, or GAE has changed what is the best option today, or whether some of these answers apply to my case.
What Python web framework would you recommend I use to send data to my asynchronous GWT app using long-polling or another method relatively simply? Could I use this web framework with GAE, or would I need to use something else?
If I understood the problem correctly you might don't need any special framework and you can solve it with what you have: Tasks API and Channel API.
With Tasks API you can perform long task and when the task is complete you can get a notification. You can combine it with the Channel API to push messages directly to the client when a particular task is complete.
You could use also the deferred library to simplify your life with tasks and maybe even using the PubNub for your push notifications, since the setup is easier and you can have many subscribers at the same time.

python client app model comunication with a Json API

Sorry in advice for my strange english.
I have to develop a client application with python that comunicate with a php server that uses JSON protocol for data exchange.
There are many python frameworks that permit to implement MVC pattern, and in particular with structured Models for data handling, but all these model structures talk directly with a database in SQL language.
My purpose is to use a single server that shots data with JSON api to all kind of devices or platforms.
So, in my python application, i would to write a syncing model storage that talks directly with my Json Server as well as an ExtJs 4 app, using a framework or a library that permits to implement easily my request.
Does anybody knows any tools that permits this ?
If I understood your question correctly, you're looking for a proxying solution to put between application server clients. It may not be 100% fit but I'd suggest looking at Ext.Direct remoting that's built in Ext JS; RPC should work fine if you don't have to publish and maintain your API. As for proxying, take a look at RPC::ExtDirect::Client. It's an Ext.Direct client implementation in Perl; I developed it mostly for testing purposes but it can probably be used for proxying, too.
On a side note, I'm not sure why exactly you would want to implement such an architecture at all. It sounds overcomplicated for no good purpose.

Categories

Resources