Problem with looping http hosted files

I have been testing the fmod playback of ogg (and other format) files.

Ogg files play back and loop fine when they are hosted on the device (iOS), but when I try to open them from http link they just don’t loop. They play, but they only play once.

The only difference in setup is that I am passing FMOD_CREATESTREAM when setting the mode. Here’s the file:

It has the Accept-Ranges header, as mentioned in another post.

I loaded that exact file in the play_stream iOS example project, and the same thing happens. It plays once, then is silent.

Any help would be greatly appreciated.

You might find some info in here https://qa.fmod.com/t/is-it-possible-to-prevent-fmod-scanning-the-whole-ogg-vorbis-file-while-opening-it

Thanks @brett that’s very helpful, but unfortunately it still doesn’t play the second time. The first play plays fine, then it just goes silent.

I took the example code in the play_stream_ios example and just changed a few lines.

I tried both FMOD_SOUND_TYPE_OGGVORBIS and FMOD_SOUND_TYPE_VORBIS.

    FMOD_CREATESOUNDEXINFO exinfo;
    memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
    exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
    exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_VORBIS;
    
    result = system->createStream(
        "https://d29bun9tgdx60n.cloudfront.net/media/sounds/z9gsDcP2OPDTwDX7/60nkpb6fxtcrawk2.ogg",
        FMOD_LOOP_NORMAL | FMOD_2D | FMOD_IGNORETAGS,
        0,
        &sound
    );
    ERRCHECK(result);

Is there something really obvious I’m missing?

Hi Josh,
Did you just try to call playSound on it again? That would be the equivalent of seeking. You should try releasing the soudn then creating it each time for a netstream so it can reconnect to the address at the start.

I did this and it worked ok. You dont need to suggest to createsound the format, it can guess it from the extension. That feature is just to avoid autodetect scanning multiple codecs if it cant work it out (its a good idea though in general if you want to avoid netstreams scanning / attempting to seek through a bunch of different formats and erroring out).

Here’s my code

result = gSystem->createStream("https://d29bun9tgdx60n.cloudfront.net/media/sounds/z9gsDcP2OPDTwDX7/60nkpb6fxtcrawk2.ogg", FMOD_IGNORETAGS, 0, &gSound[0]);
CHECK_RESULT(result);

result = gSystem->playSound(gSound[0], 0, false, &gChannel[0]);
CHECK_RESULT(result);

Sleep(5000);

result = gSound[0]->release();
CHECK_RESULT(result);

result = gSystem->createStream("https://d29bun9tgdx60n.cloudfront.net/media/sounds/z9gsDcP2OPDTwDX7/60nkpb6fxtcrawk2.ogg", FMOD_IGNORETAGS, 0, &gSound[0]);
CHECK_RESULT(result);

result = gSystem->playSound(gSound[0], 0, false, &gChannel[0]);
CHECK_RESULT(result);

Hi Brett, thanks for this. It’s not HLS, it’s just a file hosted on https (perhaps I’m confused about the nomenclature here!). As it is, I’m seriously confused as to why seeking doesn’t work - you can seek most files whenever there’s an Accept-Ranges header available, which there is in this case.

that one above definitely has one, and the embedded media player in the page actually seeks it fine.

This post also raises a similar question NetStream Loop?

For the looping, I just add the FMOD_LOOP_NORMAL flag. If you do this in the play_stream example, the player actually shows the timecode for the file continually looping, but the sound just stops.

I’d like to know if it’s
a) impossible to loop http(s) hosted files using the standard fmod methods or
b) just a bug, or missing header, or another issue

As a side note, ExoPlayer, AVAudioPlayer, and VLCKit all support seeking and looping over http(s) with most filetypes.