Streaming audio from Google App Engine

audio, google-app-engine, stream

Solution

Yep!! This is my implementation:

public class Serve extends HttpServlet {

    private static final long serialVersionUID = 5603629129606331547L;

    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
        BlobKey blobKey = new BlobKey(req.getParameter("blob-key"));
        BlobstoreServiceFactory.getBlobstoreService().serve(blobKey, res);
    }
}

.. and this is the web.xml:

<servlet>
        <servlet-name>Serve</servlet-name>
        <servlet-class><my-package>.Serve</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Serve</servlet-name>
        <url-pattern>/serve</url-pattern>
    </servlet-mapping>

pay attention that "direct url" (getServingUrl I think you mean) exists only for images: https://developers.google.com/appengine/docs/java/images/overview#Transforming_Images_from_the_Blobstore

Problem

Is it possible to stream audio-file from `BlobStore` on AppEngine in general? And if yes, what about streaming .mp3 file from direct url?

Original source