# Assertion 'gst\_uri\_is\_valid (uri)' failed

**URL:** <https://discourse.mopidy.com/t/assertion-gst-uri-is-valid-uri-failed/1709>\
**Category:** Misc\
**Created:** [July 5, 2017, 1:23pm UTC](https://discourse.mopidy.com/t/assertion-gst-uri-is-valid-uri-failed/1709 "2017-07-05T13:23:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wim\_Roose](https://avatars.discourse-cdn.com/v4/letter/w/e9a140/32.png) [@Wim\_Roose](https://discourse.mopidy.com/u/Wim_Roose)\
**Post date:** [July 5, 2017, 1:23pm UTC](https://discourse.mopidy.com/t/assertion-gst-uri-is-valid-uri-failed/1709/1 "2017-07-05T13:23:20Z")

</div>

Hi All

I’m having trouble playing a HLS stream. Stream URI [http://stroom.tv/varlife/lo\_stroom.m3u8](http://stroom.tv/varlife/lo_stroom.m3u8) returns

```
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:9
#EXT-X-MEDIA-SEQUENCE:6783
#EXTINF:8.333333,
lo_stroom6783.ts
#EXTINF:8.333333,
lo_stroom6784.ts
#EXTINF:8.333333,
lo_stroom6785.ts

```

Mopidy however (or rather Gstreamer) throws error:

> (python2:9357): GStreamer-CRITICAL \*\*: gst\_element\_make\_from\_uri: assertion ‘gst\_uri\_is\_valid (uri)’ failed  
> WARNING Download of ‘lo\_stroom7020.ts’ failed: Invalid URL ‘lo\_stroom7020.ts’: No schema supplied. Perhaps you meant http://lo\_stroom7020.ts?  
> INFO Unwrapping stream from URI failed: error downloading URI lo\_stroom7020.ts  
> WARNING Problem looking up

Is this gstreamer ignoring the domain name and saying “Can’t find http lo\_stroom7020.ts”? Is this a malformed m3u8 file? Funny thing is that I wrote a small python-gst application myself that plays the stream without a problem.

Any ideas?

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [July 5, 2017, 1:57pm UTC](https://discourse.mopidy.com/t/assertion-gst-uri-is-valid-uri-failed/1709/2 "2017-07-05T13:57:54Z")

</div>

I would guess if those were absolute paths it’d work. It looks like that’s not malformed but rather an issue with our m3u parser not supporting relative paths.

---

<div class="post-metadata">

**Author:** ![Wim\_Roose](https://avatars.discourse-cdn.com/v4/letter/w/e9a140/32.png) [@Wim\_Roose](https://discourse.mopidy.com/u/Wim_Roose)\
**Post date:** [July 5, 2017, 2:56pm UTC](https://discourse.mopidy.com/t/assertion-gst-uri-is-valid-uri-failed/1709/3 "2017-07-05T14:56:37Z")

</div>

I get it - so it’s not a gstreamer error. Shall I open an issue?

For a quick fix: should I look into m3u/translator.py ?

tnx

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [July 5, 2017, 4:56pm UTC](https://discourse.mopidy.com/t/assertion-gst-uri-is-valid-uri-failed/1709/4 "2017-07-05T16:56:48Z")

</div>

Yes I think so.

I think something to fix up any relative paths returned needs to go around [here](https://github.com/mopidy/mopidy/blob/develop/mopidy/stream/actor.py#L153).

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [July 5, 2017, 5:40pm UTC](https://discourse.mopidy.com/t/assertion-gst-uri-is-valid-uri-failed/1709/5 "2017-07-05T17:40:19Z")

</div>

I tried something like:

```auto
        next_uri = uris[0]
        # TODO Test streams and return first that seems to be playable
        logger.debug(
            'Parsed playlist (%s) and found new URI: %s', uri, next_uri)

        if not urlsplit(next_uri).scheme:
            next_uri = urljoin(uri, next_uri)
            logger.info('Translated from relative to absolute URI %s', next_uri)

        uri = next_uri

```

But the audio stops after a few seconds. I don’t know what is going on there:

```auto
DEBUG 2017-07-05 18:39:11,373 [20189:MainThread] mopidy.audio.gst
  Got EOS (end of stream) bus message.

```

EDIT: OK, I do, it’s supposed to go onto the next stream in the playlist (and so on and so on, presumably). I don’t think we support this at all.

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [July 5, 2017, 11:23pm UTC](https://discourse.mopidy.com/t/assertion-gst-uri-is-valid-uri-failed/1709/6 "2017-07-05T23:23:06Z")

</div>

[https://github.com/mopidy/mopidy/issues/1149](https://github.com/mopidy/mopidy/issues/1149) is relevant here.

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [July 6, 2017, 11:57am UTC](https://discourse.mopidy.com/t/assertion-gst-uri-is-valid-uri-failed/1709/7 "2017-07-06T11:57:33Z")

</div>

OK! So we do in fact support HLS, I got that all wrong. I think this is maybe a gstreamer issue after all. We seem to be unable to get the duration, which in turn causes our scanner to time out and then attempt to handle it as a regular playlist (which it’s not).

You can use the following to see what’s going on and compare with a working HLS stream:

```auto
$ GST_DEBUG=3 python mopidy/audio/scan.py http://stroom.tv/varlife/lo_stroom.m3u8
$ GST_DEBUG=3 python mopidy/audio/scan.py https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear1/prog_index.m3u8

```
