# Problem with looping http hosted files

**URL:** https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415
**Category:** FMOD Engine
**Created:** [January 28, 2020, 12:19pm UTC](https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415 "2020-01-28T12:19:04Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![joshechoes](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joshechoes/32/558_2.png) [@joshechoes](https://qa.fmod.com/u/joshechoes)
#### Post date: [January 28, 2020, 12:19pm UTC](https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415/1 "2020-01-28T12:19:04Z")

</div>

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:

[https://d29bun9tgdx60n.cloudfront.net/media/sounds/z9gsDcP2OPDTwDX7/60nkpb6fxtcrawk2.ogg](https://d29bun9tgdx60n.cloudfront.net/media/sounds/z9gsDcP2OPDTwDX7/60nkpb6fxtcrawk2.ogg)

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.

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [January 29, 2020, 12:20am UTC](https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415/2 "2020-01-29T00:20:24Z")

</div>

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](https://qa.fmod.com/t/is-it-possible-to-prevent-fmod-scanning-the-whole-ogg-vorbis-file-while-opening-it)

---

<div class="post-metadata">

### Author: ![joshechoes](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joshechoes/32/558_2.png) [@joshechoes](https://qa.fmod.com/u/joshechoes)
#### Post date: [January 29, 2020, 1:09pm UTC](https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415/3 "2020-01-29T13:09:27Z")

</div>

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`.

```auto
    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?

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [February 4, 2020, 12:28am UTC](https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415/4 "2020-02-04T00:28:05Z")

</div>

> [@joshechoes](#):
>
> [https://d29bun9tgdx60n.cloudfront.net/media/sounds/z9gsDcP2OPDTwDX7/60nkpb6fxtcrawk2.og](https://d29bun9tgdx60n.cloudfront.net/media/sounds/z9gsDcP2OPDTwDX7/60nkpb6fxtcrawk2.og)

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);

```

---

<div class="post-metadata">

### Author: ![joshechoes](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joshechoes/32/558_2.png) [@joshechoes](https://qa.fmod.com/u/joshechoes)
#### Post date: [February 5, 2020, 12:25pm UTC](https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415/5 "2020-02-05T12:25:41Z")

</div>

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.

[https://content.echoes.xyz/media/sounds/z9gsDcP2OPDTwDX7/60nkpb6fxtcrawk2.ogg](https://content.echoes.xyz/media/sounds/z9gsDcP2OPDTwDX7/60nkpb6fxtcrawk2.ogg)

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?](https://qa.fmod.com/t/netstream-loop/15101/5)

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.

---

<div class="post-metadata">

### Author: ![joshechoes](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joshechoes/32/558_2.png) [@joshechoes](https://qa.fmod.com/u/joshechoes)
#### Post date: [March 4, 2020, 10:06pm UTC](https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415/6 "2020-03-04T22:06:48Z")

</div>

Hi @brett . Sorry to bump the thread, but did you have any thoughts on this problem?

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [March 10, 2020, 5:04am UTC](https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415/7 "2020-03-10T05:04:20Z")

</div>

Apologies for the delay, i’ve looked into it now.  
There is an issue in the network file handling that I have discovered. I have fixed it for the next minor release update.  
Brett

---

<div class="post-metadata">

### Author: ![joshechoes](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joshechoes/32/558_2.png) [@joshechoes](https://qa.fmod.com/u/joshechoes)
#### Post date: [March 10, 2020, 7:44am UTC](https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415/8 "2020-03-10T07:44:55Z")

</div>

Incredible! Thanks @brett. 🤞 this fixes the problem.

Josh

---

<div class="post-metadata">

### Author: ![iADBE](https://avatars.discourse-cdn.com/v4/letter/i/8e7dd6/32.png) [@iADBE](https://qa.fmod.com/u/iADBE)
#### Post date: [March 1, 2022, 6:24pm UTC](https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415/9 "2022-03-01T18:24:51Z")

</div>

How do we go about working with .m3u8 files for HLS for FMOD?

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [March 3, 2022, 11:26pm UTC](https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415/10 "2022-03-03T23:26:11Z")

</div>

you would have to download and parse those types of file yourself at this time.

edit: HLS is a special API for low latency streaming, fmod does not support this either

---

<div class="post-metadata">

### Author: ![iADBE](https://avatars.discourse-cdn.com/v4/letter/i/8e7dd6/32.png) [@iADBE](https://qa.fmod.com/u/iADBE)
#### Post date: [March 4, 2022, 7:14pm UTC](https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415/11 "2022-03-04T19:14:32Z")

</div>

Is HLS support on the development roadmap?

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [March 7, 2022, 12:02am UTC](https://qa.fmod.com/t/problem-with-looping-http-hosted-files/15415/12 "2022-03-07T00:02:18Z")

</div>

It is possible it works now as we run audio streaming of AAC through AudioQueue (iOS only) but I have not checked it on my side, just Windows testing here right now. I can see m3u8 uses #EXT-X-VERSION tag vs m3u which we support via #EXTINF tag, so that file format version I can confirm is not supported, but it probably wouldnt take much work to support the different ID fields it uses to get the strings out.

Right now HLS and M3U8 official support is not on our roadmap. Standard http streaming is supported via our API.
