Hello, I upload sound file from my android app so that other users should have access to it. But it didnt work so that I opened my parse server in the browser. I couldnt download the audio files because I got the message: ERR_CONNECTION_REFUSED. I read that publicServerURL should be configured when ParseFiles are used. I configured it to ServerUrl in putty, but I still dont have access to my files. Where is my error?
My code looks like this=
ParseQuery<ParseObject> queryaudio = ParseQuery.getQuery("AudioFileClass");
queryaudio.whereEqualTo("GroupID", MainActivity.sharedPreference.getString("group", ""));
queryaudio.addAscendingOrder("createdAt");
queryaudio.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> audioobjects, ParseException e) {
if (e == null) {
for (int a = 0; a < audioobjects.size(); a++) {
Log.i("For", "Ebene1");
Date aktuelleZeit = Calendar.getInstance().getTime();
if (printDifferenceMiliSecond(lastPlayed, audioobjects.get(a).getCreatedAt()) > 0 && printDifferenceSecond(audioobjects.get(a).getCreatedAt(), aktuelleZeit) < 30 && !audioobjects.get(a).get("UserID").equals(MainActivity.actuallyNetter.getObjectId())) // && !audioobjects.get(a).get("UserID").equals(MainActivity.actuallyNetter.getObjectId())
{
Toast.makeText(MapsActivity.this, "Sound wird abgespielt", Toast.LENGTH_SHORT).show();
Log.i("If","Drin");
ParseFile descr = audioobjects.get(a).getParseFile("audiofile");
String audioFileURL = descr.getUrl();
Log.i("URL",audioFileURL);
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
lastPlayed = audioobjects.get(a).getCreatedAt();
try {
mediaPlayer.setDataSource(audioFileURL);
mediaPlayer.prepare();
mediaPlayer.start();
} catch (IOException ex) {
ex.printStackTrace();
Log.i("Exception","Drin");
}
}
}
} else {
Log.d("score", "Error: " + e.getMessage());
}
}
});
The error looks like this=
2020-09-10 20:59:55.630 1711-24604/? E/NuCachedSource2: source returned error -1, 0 retries left
2020-09-10 20:59:55.672 1711-24603/? E/GenericSource: initFromDataSource, cannot create extractor!
2020-09-10 20:59:55.672 1711-24603/? E/GenericSource: Failed to init from data source!
2020-09-10 20:59:55.673 1711-24602/? D/NuPlayerDriver: notifyListener_l(0xe7899600), (100, 1, -2147483648, -1), loop setting(0, 0)
2020-09-10 20:59:55.674 24403-24515/com.example.hilmi.carlink E/MediaPlayerNative: error (1, -2147483648)
2020-09-10 20:59:55.675 24403-24403/com.example.hilmi.carlink W/System.err: java.io.IOException: Prepare failed.: status=0x1
2020-09-10 20:59:55.676 24403-24403/com.example.hilmi.carlink W/System.err: at android.media.MediaPlayer._prepare(Native Method)
2020-09-10 20:59:55.676 24403-24403/com.example.hilmi.carlink W/System.err: at android.media.MediaPlayer.prepare(MediaPlayer.java:1282)
2020-09-10 20:59:55.676 24403-24403/com.example.hilmi.carlink W/System.err: at com.example.hilmi.carlink.MapsActivity$2$3.done(MapsActivity.java:406)
2020-09-10 20:59:55.676 24403-24403/com.example.hilmi.carlink W/System.err: at com.example.hilmi.carlink.MapsActivity$2$3.done(MapsActivity.java:384)
2020-09-10 20:59:55.676 24403-24403/com.example.hilmi.carlink W/System.err: at com.parse.ParseTaskUtils$2$1.run(ParseTaskUtils.java:121)
2020-09-10 20:59:55.676 24403-24403/com.example.hilmi.carlink W/System.err: at android.os.Handler.handleCallback(Handler.java:873)
2020-09-10 20:59:55.676 24403-24403/com.example.hilmi.carlink W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
2020-09-10 20:59:55.677 24403-24403/com.example.hilmi.carlink W/System.err: at android.os.Looper.loop(Looper.java:193)
2020-09-10 20:59:55.677 24403-24403/com.example.hilmi.carlink W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6669)
2020-09-10 20:59:55.677 24403-24403/com.example.hilmi.carlink W/System.err: at java.lang.reflect.Method.invoke(Native Method)
2020-09-10 20:59:55.677 24403-24403/com.example.hilmi.carlink W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
2020-09-10 20:59:55.677 24403-24403/com.example.hilmi.carlink W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Could you please share your parse server options? It is hard to see int he image you attached.
Do I had to restart my parse server after editing the config.json file? If yes, how do I do that?
Yes. You need to restart your process. It depends on how you are running your process. It looks you are using a bitnami server. I have no idea but maybe they have some docs teaching how to do that.
Have you solved the problem? I have the same