mirror of
https://github.com/apache/cordova-android.git
synced 2026-05-11 00:00:05 +08:00
Removing cruft before restarting the work on the new android API
This commit is contained in:
@@ -114,65 +114,6 @@ public class PhoneGap{
|
||||
});
|
||||
}
|
||||
|
||||
public void playSound(final String filename)
|
||||
{
|
||||
MediaPlayer mp = new MediaPlayer();
|
||||
|
||||
try {
|
||||
// MediaServer does not allow reading of urls out of app data folder
|
||||
// thus we grab raw file and submit via file descriptor
|
||||
// instead
|
||||
// InputStream is = mCtx.getAssets().open(filename);
|
||||
// work around cannot play audio streams
|
||||
// to get around security restriction on MediaPlayer
|
||||
// until Android sdk 1.1
|
||||
// thus these changes and the playSound js
|
||||
// needs moved to Dev.x so that we can if statement out
|
||||
// via the sdk number
|
||||
|
||||
if(getSDKVersion() == "1")
|
||||
{
|
||||
// The hack way audio stored in R.raw.filename
|
||||
// and we if statement check our way through
|
||||
// to match the window.DroidGap.playSound(filename.mp3)
|
||||
////call on the html side
|
||||
|
||||
int oursound;
|
||||
|
||||
if (filename == "bird.mp3") {
|
||||
mp.create(mCtx, R.raw.bird);
|
||||
|
||||
}
|
||||
if (filename == "on.mp3") {
|
||||
mp.create(mCtx, R.raw.on);
|
||||
}
|
||||
if (filename == "off.mp3"){
|
||||
mp.create(mCtx, R.raw.off);
|
||||
}
|
||||
}
|
||||
if(getSDKVersion() == "1.1")
|
||||
{
|
||||
//TODO: do right way here when Google fixes it
|
||||
// as we have a security exception preventing
|
||||
// playing audio file form file:///android_asset/ location
|
||||
mp.setDataSource("file:///android_asset/" + filename);
|
||||
mp.prepare();
|
||||
mp.start();
|
||||
}
|
||||
|
||||
//mp.setDataSource("file:///android_asset/" + filename);
|
||||
//mp.setDataSource("http://ventrix.nsdc.gr/stuff/TERMITES_SKONH.mp3");
|
||||
mp.prepare();
|
||||
mp.start();
|
||||
} catch (IllegalArgumentException e) {
|
||||
//TO-DO: Load a Javascript Exception thrower
|
||||
} catch (IllegalStateException e) {
|
||||
//TO-DO: Load a Javascript Exception thrower
|
||||
} catch (IOException e) {
|
||||
//TO-DO: Load a Javascript Exception thrower
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String outputText(){
|
||||
String test = "<p>Test</p>";
|
||||
|
||||
Reference in New Issue
Block a user