Ways to Embed Media Files in Your App    
This topic is assigned to Admin

--Admin--
Mar 06, 2012 09:01 AM
Media is what makes most of the apps shine on the App Store or Android Market, so before you add audio or video files to your app, you might want to inspect all the possible ways to do that. In general, there two majorly different ways to add media files to an app: adding them to the resources of your app and distributing them together with the .app file for iOS apps or .apk file for Android apps depending on the platform; or streaming the media to users’ device over the Internet when they choose to play it.

There is a number of pros and cons for each method which are explained below:

Adding media files to the application bundle
The reasons why you would want to bundle audio or video together with the executables of your application is because of its constant and reliable availability to the users of your app and to save their traffic. Once an audio or video or indeed any other file gets bundled together with the app’s resources, it becomes immediately available when it is needed. The only drawback is that this technique majorly increases the size of your app. Media files are notorious for their size so check twice before bundling them. Note that Android Market allows the .apk file to be under 50 MB and application downloads over cellular networks including 3G allowed only for apps under 20 MB on the App Store.

Also, bundling your media you can benefit of dedicated SeattleClouds custom URL schemes that allow you play audio in background or open it in OS’ default player. SeattleClouds Custom URL schemes tutorial is available at www.seattleclouds.com/custom-url-schemes.

Adding a media file to the resources of your app is as easy as adding any other file: go to your app’s Dashboard → Edit Pages → Resource Manager → Upload File.



Streaming media files from the Internet
Note the three radio buttons below the upload interface on the image above, you are already familiar with the first option, the other two however allow you to avoid bundling your media with resources in favor of streaming them to the users’ devices over the Internet from SeattleClouds server.

The second option is for converting your audio files to HTTP Live Streaming (HLS) format supported by iOS 3.0 and higher and Android 3.0 and higher (read HTTP Live Streaming Overview at iOS Developer Library). Once you have uploaded and converted one of your audio files to HTTP Live Streaming format, use this link to enable the stream:

<a href="http://seattleclouds.com/myapplications/USER-ID/APP-ID/FILE-NAME​​​​​​​​/index.m3u8>Play</a>

Make sure to substitute USER-ID, APP-ID and FILE-NAME keys with your username, application ID and file name.

The second way of streaming both audio and video files requires a URL similar to this:

<a href=http://seattleclouds.com.myapplications/USER-ID/APP-ID/FILE-NAME.​​​mp3/index.m3u8>Play</a>

Note that file name is repeated twice, this is correct. In this case no streaming format is applied, files are just downloaded from SeattleClouds server as they are.

Finally you can upload your media files to a hosting of your choice like YouTube or Vimeo and use embed code from there. Make sure to check that the stream format is compatible with the target platform of your app.

    1