Page 1 of 2

audio stopped when invoke RESTservice

Posted: Thu Jul 03, 2014 5:22 am
by Danny Nguyen

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


audio stopped when invoke RESTservice

Posted: Thu Jul 03, 2014 10:03 am
by Evgene Karachevtsev

Hello Danny,

We could reproduce your issue, working on it.


audio stopped when invoke RESTservice

Posted: Thu Jul 03, 2014 2:57 pm
by Kateryna Grynko

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?


audio stopped when invoke RESTservice

Posted: Thu Jul 03, 2014 4:21 pm
by Danny Nguyen

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,


audio stopped when invoke RESTservice

Posted: Thu Jul 03, 2014 7:55 pm
by Kateryna Grynko

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.


audio stopped when invoke RESTservice

Posted: Thu Jul 03, 2014 8:03 pm
by Danny Nguyen

Hi Katya,

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

where do I place these codes under ?

Thanks,


audio stopped when invoke RESTservice

Posted: Thu Jul 03, 2014 9:01 pm
by Kateryna Grynko

Hi Danny,

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

Add this code to a custom service realization.


audio stopped when invoke RESTservice

Posted: Thu Jul 03, 2014 9:39 pm
by Danny Nguyen

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;


audio stopped when invoke RESTservice

Posted: Fri Jul 04, 2014 4:42 pm
by Kateryna Grynko

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.


audio stopped when invoke RESTservice

Posted: Sun Jul 06, 2014 3:07 pm
by Danny Nguyen

Hi Kaya,

Thanks for getting back to me.

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

Thanks.

Regards,