I am making an app in Unity for android which plays a whole bunch of videos.
Since the apk would be too big if all videos were added at build time, I download the videos at runtime and store them using: Application.persistentDataPath + "/"+filename+".mp4";
The problem is that I am playing the videos inside unity but some devices do not support this functionality (API too low or GPU doesn't support a specific openGL extension), so in those cases my fallback solution is to use androids native player by calling: Handheld.PlayFullScreenMovie(path)
Unfortunately, the videos are stored without world-readable access and therefore the native player is not able to play the downloaded videos.
So my question is, is there a way to make these file world-readable using the path currently used? If not, is there a reliable location where I can store these files where the native player will have access to them regardless of android device?
Related
I am working on a cordova android application which will display images and videos.I have the images and videos in the assets folder.I want to protect my resources.I don't want anyone to copy the resources.I have googled for the same and didn't get any proper solution.How to protect files in assets?
Is there any way to encrypt and store videos in assets folder and decrypt it during run time?
My video files will be maximum of 10 MB each file and there are 50 videos in the whole application.
You can definitely do this with DRM - it won't stop someone copying the video files, but as they are encrypted they will not be able to play them back without the correct key.
The process is roughly:
your content is encrypted before it is streamed or downloaded
when the user wants to playback the content the app must request a key for the content from owner of the content or the 'rights authority' (a service which handles keys for content)
The DRM system on the device will securely encrypt the content and play it back using the key it obtained. The video will not be stored in clear format at any point.
Native Android DRM is explained here:
http://developer.android.com/reference/android/drm/package-summary.html
To use this with cordova I think you will have to create a Native plugin - I could not see any cordova DRM API. Alternatively, if you are able to stream the content using the new MPEG DASH format, then you could use a HTML5 video player which supports DRM, such as BitDASH (https://www.dash-player.com).
You need to be aware that all DRM and encryption systems are really just hurdles that make it harder to copy content - at the end of the day if you have a very high quality display and a very high quality camera to record the display, then no DRM protection will save you.
I have an app I am developing that needs to include about 55MB of audio (mp3s) these are short files and about 1000 in total. Bundling these in the apps assets makes the compiled apkabout 60MB.
I want to upload this app to the play store but of cause its to big as it it.
So my questions is, before I start working on using the APK Expansion File system is there anyway I could compress the audio files so the apk fits in under the 50MB limit?
The audios current bit rate is 128kbps
I guess Its better if you can make a player for stream the audio from the internet just like youtube does for their android application to play video files on android phone.
Additionally you can give option to the user to select save the audio for next time play without internet download.
I think this is a good question and +1 from me
I have my android app where data is packed using FileWrap. The thing is I want to wrap the mp3 data into the android file and play from that memory. I have checked the nativeaudio example in NDK which shows how to play MP3 as an asset or as a filesystem file, but it does not show how I can play an MP3 that is embedded into memory.
Please help. Thanks.
I don't think that is possible... yet.
AFAIK android opensl only supports MP3 decode & playback from a stream...
I have not seen the latest ndk release (r9b) yet, but if the opensl example app does not support in-memory, on-the-fly decoding, I doubt it is available.
Perhaps having a look here may clear things up:
https://groups.google.com/forum/#!searchin/android-ndk/opensl|sort:date/android-ndk/cMHlkyQkFU0/vMkyO2201yYJ
Or you could just dump your MP3 files in the "assets" folder and play them using the AAssetManager as per usual.
I have few SWF Files which I want to run view on my Android Device.
Earlier I was viewing those files in webview using flash player but now as flash player plugin is no more available on play store so the person who has not flash player plugin already can not view those files.
How can I show my SWF files without using Flash Player Plugin ?
You can use opensource code like SWFDec, but you have to porting it on android by yourself.
How to porting:
1. download swfdec source code from http://swfdec.freedesktop.org
2. cross-compile swfdec source code for android platform
3. read swfdec source code to find how to blit swfdec surface to android view
Google's Swiffy makes Flash files HTML5 friendly.
Google's cooked up a new tool in its labs that converts SWF files into HTML5 for use on devices that can't run Flash, including those made by Apple.
I use Adobe AIR for swf files to play b'cause its still free, but it does require you to sign up.. Here is setup require to getting started with Adobe AIR.. There is lot of stuff in that link well, you require only app, for viewing .swf file...
Firefox comes with SWF support. I had to play a SWF file in Android. Here's how I did it.
Download the SWF file to store locally in your device. Most likely by default it will be in the root/sdcard/download folder.
Open Firefox browser. Type in the URL file://root/sdcard/download/myFlashFilename.swf
It should show a "Tap to activate plugin" or similar message. Tap it and it should work.
Add this to Bookmark and Add to Home Screen for easy access.
I've been following this blog to help me make a simple music player function with an Android app (http://simonmacdonald.blogspot.com/2011/05/using-media-class-in-phonegap.html).
All works well - but I would like some way to extract a list of all music media stored on the phone so the user can click a file and play it. Does anyone know if this is possible via phone gap? I'd need to access track name/artist etc and a link to the track.
Cheers
Paul
Prognosis is not good.... PhoneGap does not have an API for accessing the media library. So, you would have to fall back to the File API to locate music files, and then... you would have to read the binary data in the actual files to extract out the track/artist metadata. Ouch. Seems pretty impractical.
[EDIT]
By the way, PhoneGap is not the only game in town. Appcelerator seems to solve the same problem, and apparently has a richer API, which includes
access to media metadata