cocos2d-x how to play background music on android - android

I know if the music file under the 'Resources', it can work well.
But now, the music file under the '/data/' directory. It cant't play! why?

You can access via absolute path, example: /data/data/your.package.name/files/music.mp3

Related

How to make videos download and play inside unity app?

Hello so I am trying to make online videos download on the android export app from unity and then play it back in the same app. so far I have used a plugin EasyMovieTexure asset for streaming online videos but cannot find a way to download videos and play them. I have searched and found that I can download the video with Android Application.persistentDataPath but I don't know how to use it and save the video file to a location on android.
Help is much appreciated.
the easiest way will be using System.IO.File.WriteAllBytes () to save all byte data from the WWW object. But this method actually need RAM to hold the whole file for a while. It doesn't work if the file is too big. if the file size is too big, you probably need another way to do the downloading and saving

How to protect media in your android from sharing?

like a media file say video by any means like bluetooth or wifi. The point is i dont want someone to copy my video when phone is in their hands when i am not around?
If you want to do this via programmatically, store your media files in a separate file and prefix your folder with a "." (dot). then folder will be invisible.
if you need more information.. i would like to help.. first try it yourself and ask for source code help
If you want some android application.. check following application from android app store
1) Hide Something - Photo, Video
2) File Hide Expert
3) Hide Images Videos and Files

Video Library for Processing Android

I need a video library for "Processing Android" to play some videos in my game. I tried ApWidget VideoView but it works only when a video file is placed on sd card and its path is provided to video view object. But how can i play videos that are placed in data folder of my sketch?
My experience is assets such as videos or images have to be in the Assets folder in your app tree (I'm assuming you use Eclipse). Otherwise your assets won't export when you compile the app.
If there's an issue with the code, we need to see it to answer further. Best of luck!

Playing local audio file in Android webview app

I have a simple Android webview app, built with Phonegap Build. When trying to play a local mp3 file that's included in the APK, nothing happens. However, if I pull an mp3 from the web it works.
e.g.
<audio src="www.example.com/01.mp3" > WORKS JUST FINE
<audio src="01.mp3" > DOES NOT WORK
I'm new to Android development, so I can only guess that the file is somehow inaccessible by Android's media player. Here's a link to the errors/warnings from my log file if that helps shed any light on the problem.
http://pastebin.com/isS542RE
I have it working using Phonegap's Media class. I must have been doing something wrong initially, but I'm not sure what. The proper way to access it through the media object is as Simon stated previously:
myMedia = new Media("/android_asset/www/test.mp3");
You have to put the full path as the media class defaults to the /SDCARD directory on relative paths.
Simon also has a great write up about using the media class:
http://simonmacdonald.blogspot.com/2011/05/using-media-class-in-phonegap.html?m=1
As for the HTML5 method and using the AUDIO tag, I'm still not certain why it fails on local files. Phonegap's media class works just fine though and is probably a more reliable solution anyhow. Phonegap FTW!
Have you tried pointing the file to the local file system path using "file:///android_assets/01.mp3" assuming your .mp3 is within the applications assets directory?
We had the same problem, the media files, in order to be played, needs to be in the external storage dir. Try to move your HTML and related files to /mnt/sdcard/.
I filed an official bug report on this:
http://code.google.com/p/android/issues/detail?id=41995&thanks=41995&ts=1356643666

Phonegap Android App - Display Store MP3 Media

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

Categories

Resources