Superpowered Decoder for remote URL

222 Views Asked by At

I have successfully decoded a local file using Superpowered

SuperpoweredDecoder *decoder = new SuperpoweredDecoder();
const char *openError = decoder->open("/Users/john/Desktop/myFile.mp3", false, 0, 0);

    if (openError) {
        NSLog(@"open error: %s", openError);
        delete decoder;
        return 0;
    };

Now I'd like to do the same with a remote URL

eg. by replacing the decoder->open call with...

 const char *openError = decoder->open("https://example.com/api/mobile/courses/redirect/Z3VpZpZGVvcy9qbTMwYWJnLTAwMS5tcDM%3D?courseid=678");

(I've changed the URL a bit here as it's not a URL I should be releasing, however, I have confirmed that the URL was good by pasting it into Chrome address bar - Chrome plays the mp3)

the result: open error: @

The Superpowered documentation describes path as: Full file system path or progressive download path (http or https). so I thought this might be possible.

Do I need to be setting customHTTPHeaders - if so, any guidance on how to use this field?

1

There are 1 best solutions below

3
On

This is undocumented, beta behaviour yet. The @ means that the open() method needs more time to open the file (due network traffic). Just iterate over open() until you receive something else than '@'. Don't forget to sleep() between the iterations to allow the network stack doing its job.