0

I read and hope that I have followed the advice about the resource access, mentioned in How to access a resource in Java project using Gradle? .. but without success. My configuration is not really the same (but I think that it does not matter):

  • In src/main/java: there is the package called "pack" in which there are all java files

  • In src/main/resources, there are all mp3 and wav files

And here is the part of Java code:

String musicFile = "deepSpaceInit.mp3";
URL resource = GluonApplication.class.getClassLoader()getResource(musicFile); // that works

// URL resource = GluonApplication.class.getResource(musicFile); // that works too with the same result

// resource is equal to jar:file/data/app/pack-2/base.apk!/deepSpaceInit.mp3

BUT, this next line does not work whereas the URL seems to be found (and correct):

Media soundMedia = new Media(resource.toExternalForm());

// Media soundMedia = new Media(resource.toString()); // it does not work too

The error (through adb) is:

" D/QMCX983D (374): Waiting for enable m or o sensor"

"QMC_IOCTL_GET_OPEN_STATUS failed"

"QMC_IOCTL_GET_DELAY failed"

"QMC_IOCTL_GET_YPR failed"

Have you an idea for solving this problem?

Note: GluonApplication is the "main" class for Gluon (i.e.the class in which there is the "start" input)

Note: Before getting this problem above, the javafx code worked fine in "pure" Java debug (application for PC platform), but it did not work when this application was ported for Android platform:

String musicFile = "deepSpaceInit.mp3"; 

Media sound = new Media(new File(repertoireMP3 + musicFile).toURI().toString()); // it does not work

with repertoireMP3 = "" or "/" or "./" or "src/main/resources" or "/src/main/resources"  ... without success 
Community
  • 1
  • 1
Pascal DUTOIT
  • 121
  • 1
  • 13
  • In http://stackoverflow.com/questions/38419634/javafxports-how-to-call-android-native-media-player, they say: "As the javafxports Media is not yet implemented I'm looking to use the Android Native MediaPlayer instead. Does anyone know how to do this." Is it always true? – Pascal DUTOIT Dec 14 '16 at 13:24
  • What is a simple technical solution to solve this problem about reading a audio resource (with a correct Real Time, of course)? – Pascal DUTOIT Dec 14 '16 at 13:48

0 Answers0