Media not found event?

I have a scenario where if a media item is not found at its location use a backup media location.
I’d like to do this through a media load method with a timeout property and an event that is raised if it’s not found.
Is this available? If not is there a recommended approach?

THX

Tom

We don’t have an auto-retry to a different media location…

I suggest you code it in your app. You can check the media url first with roUrlTransfer and if it doesn’t exist use the backup media location. You can use the Range: header in your request to check existence of URL without downloading a lot of data.


Function isUrlValid(url As String) As Boolean
    urlValid = false
    http = CreateObject("roUrlTransfer")
    http.SetPort(CreateObject("roMessagePort"))
    http.SetUrl(url)
    http.AddHeader("Range","bytes=0-15")
    if (http.AsyncGetToString())
        event = wait(5000, http.GetPort())
        if type(event) = "roUrlEvent"
            if (event.GetResponseCode() >= 200 and event.GetResponseCode() < 300) then 
                response = event.GetString()
                print "response: "; response
                urlValid = true
            end if 
        elseif event = invalid
            http.AsyncCancel()
        else
            http.AsyncCancel()
        endif
    endif

    return urlValid

End Function

–Kevin

Thanks, Just what I needed.