• Resolved siamsa

    (@siamsa)


    Is there any way to update or refresh the displayed data when the information in the endpoint changes? My use case is an online radio station displaying the currently playing track. I’m trying to update the artist/track information displayed on the website when the track changes in the audio stream.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author berkux

    (@berkux)

    Hi,
    try
    [jsoncontentimporter url=https://cast02.siamsa.ie/public/radio_siamsa/api/live/nowplaying/radio_siamsa basenode=now_playing.song] {text}<img src={art}> [/jsoncontentimporter]

    Every time the wordpress-page is called (unless it is cached by a caching-plugin) the shortcode is executed, the URL retrieved and the info displayed.

    Bernhard

    Thread Starter siamsa

    (@siamsa)

    Thanks for that Bernhard. This will certainly retrieve the data once the url is retrieved.

    However, in my scenario, the user leaves the page open to listen to an audio stream. The endpoint data changes about every 3 minutes as the audio track changes. But the data displayed by the jsoncontentimporter template doesn’t update to reflect the changed track data – it keeps the same data as when the url was initially retrieved.

    Is there any way to poll the endpoint and update the displayed data when a change is detected?

    I came across your other plugin “Auto Refresh API Ajax”, but I’m not sure that the two plugins integrate, or how they can be integrated.

    Plugin Author berkux

    (@berkux)

    Thread Starter siamsa

    (@siamsa)

    Thanks again Bernhard.

    Further question – does this permit only 1 data field (eg, song title) to be updated?

    In my case, I need to update 4 data fields (song title, artist, album title and album artwork) each time the audio track changes.

    Plugin Author berkux

    (@berkux)

    Hi, switch to the support of this plugin, please:
    https://wordpress.org/plugins/auto-refresh-api-ajax/

    Bernhard

    • This reply was modified 6 years, 5 months ago by berkux.
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Update results when API data changes’ is closed to new replies.