Danny Nguyen
Posts: 0
Joined: Tue Apr 22, 2014 3:24 pm

audio stopped when invoke RESTservice

I have created a RESTservice to obtain data from JSON for songs details (e.g. artist, title, album_image, etc)

I added this code to retrieve data every 20s.

setTimeout(function() {

Code: Select all

 [i]//location.reload(); ----- I have tried this code but it does not work[/i] 

 restservice_radio_startpage.execute({}); 

}, 20000);

However, whenever the service invoked, the audio streaming stop and I had to press "play" button again.

My app is currently shared for support team. The app/project name is "Hy Vong Radio".

Please help.

Regards,

Danny

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

audio stopped when invoke RESTservice

Hello Danny,

We could reproduce your issue, working on it.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

audio stopped when invoke RESTservice

Hi Danny,

You could use Appery.io Audio component.
http://devcenter.appery.io/documentat...

Why do you invoke restservice_radio_startpage in an infinite loop?

Danny Nguyen
Posts: 0
Joined: Tue Apr 22, 2014 3:24 pm

audio stopped when invoke RESTservice

Hi katya - I have tried with the Audio compoent. It stop, whenever I invoke the service.

I need to refresh/reload the song detail every 20 seconds, so I use restservice_radio_startpage. I could not find any other way to get the song details. If you have other way, please let me know.

Thanks.

Regards,

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

audio stopped when invoke RESTservice

Hi Danny,

You can do an asynchronous request, for example:prevar html = $.ajax({
url: "http://example.com",
async: true
}).responseText;/preFind more here: http://api.jquery.com/jquery.ajax/
You can use your Generic service implementation for this purpose.

Danny Nguyen
Posts: 0
Joined: Tue Apr 22, 2014 3:24 pm

audio stopped when invoke RESTservice

Hi Katya,

So I don't have to use RESTservice? If not,

where do I place these codes under ?

Thanks,

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

audio stopped when invoke RESTservice

Hi Danny,

You can read here about Generic service: http://devcenter.appery.io/documentat...

Add this code to a custom service realization.

Danny Nguyen
Posts: 0
Joined: Tue Apr 22, 2014 3:24 pm

audio stopped when invoke RESTservice

I'm not sure where "service realization" is ?

is it in here "Custom Implementation" ? Image

If so, I added the following:

var html = $.ajax({
url: "http://www.hosannacc.org/hyvongradio/...",
async: true
}).responseText;

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

audio stopped when invoke RESTservice

Hi Danny,

You would need to manually add response parameters and the following service realization:
preprocess : function(settings) {
settings.beforeSend(settings);
if (this.requestOptions.echo) {
settings.success(this.requestOptions.echo);
} else {
var response = $.ajax({
url: "http://www.hosannacc.org/hyvongradio/radio_rest.php",
async: true
});
settings.success(JSON.parse(response.responseText));
}
settings.complete('success');
}/preThis may not work on browser so test it on device as it uses cross domain requests.

Danny Nguyen
Posts: 0
Joined: Tue Apr 22, 2014 3:24 pm

audio stopped when invoke RESTservice

Hi Kaya,

Thanks for getting back to me.

Where is the "service realization" ? where do I enter those codes?

Thanks.

Regards,

Return to “Issues”