# Examples for Flash over HTTP live streaming

**URL:** <https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [April 30, 2013, 4:47pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633 "2013-04-30T16:47:33Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![pradeepkg](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@pradeepkg](https://forums.plex.tv/u/pradeepkg)\
**Post date:** [April 30, 2013, 4:47pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/1 "2013-04-30T16:47:33Z")

</div>

I have been working on gettng channel to stream live content over Flash on HTTP. I am unbale to find a good example to refer to.

&nbsp;

Could anyone point to good example for streming channels ?

---

<div class="post-metadata">

**Author:** ![meo](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/meo/32/4534_2.png) [@meo](https://forums.plex.tv/u/meo)\
**Post date:** [May 2, 2013, 6:39pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/2 "2013-05-02T18:39:23Z")

</div>

> I have been working on gettng channel to stream live content over Flash on HTTP. I am unbale to find a good example to refer to.
> 
> Could anyone point to good example for streming channels ?

Hi!

Can you please elaborate? Do you mean FLV video files over HTTP?&nbsp;For which site are you building the plugin?

---

<div class="post-metadata">

**Author:** ![pradeepkg](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@pradeepkg](https://forums.plex.tv/u/pradeepkg)\
**Post date:** [May 2, 2013, 6:54pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/3 "2013-05-02T18:54:23Z")

</div>

I have a live streaming URL [http://bglive-a.bitgravity.com/ndtv/247lo/live/native](http://bglive-a.bitgravity.com/ndtv/247lo/live/native) for which I am trying to build a channel.

When I meant a FLV over HTTP, the video is a HTTP stream and played using a FLV based player. THe original page for the content is [http://www.ndtv.com/video/live/channel/ndtv24x7](http://www.ndtv.com/video/live/channel/ndtv24x7)

I followed all the steps / tips suggested in the [http://forums.plexapp.com/index.php/topic/59274-newbie-http-flv-steaming-channel-development/](http://forums.plexapp.com/index.php/topic/59274-newbie-http-flv-steaming-channel-development/) with little luck.

---

<div class="post-metadata">

**Author:** ![meo](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/meo/32/4534_2.png) [@meo](https://forums.plex.tv/u/meo)\
**Post date:** [May 2, 2013, 7:49pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/4 "2013-05-02T19:49:40Z")

</div>

> I have a live streaming URL [http://bglive-a.bitgravity.com/ndtv/247lo/live/native](http://bglive-a.bitgravity.com/ndtv/247lo/live/native) for which I am trying to build a channel.
> 
> When I meant a FLV over HTTP, the video is a HTTP stream and played using a FLV based player. THe original page for the content is [http://www.ndtv.com/video/live/channel/ndtv24x7](http://www.ndtv.com/video/live/channel/ndtv24x7)
> 
> I followed all the steps / tips suggested in the [http://forums.plexapp.com/index.php/topic/59274-newbie-http-flv-steaming-channel-development/](http://forums.plexapp.com/index.php/topic/59274-newbie-http-flv-steaming-channel-development/) with little luck.

Ok, that's almost there, using the Redirect is how I would do it. I've mostly been using URL services when writing channels so I'll give you an example below which requires an URL service:

In \_\_init.py\_\_ where you should return an URL to the video:

```
def Videos():
	dir = ObjectContainer(title1 = "TEST VIDEOS")

```
dir.add(
	EpisodeObject(
		url = 'http://bglive-a.bitgravity.com/ndtv/247lo/live/native',
		title = "TEST VIDEO")
)		

	
return dir

```
```

In ServiceCode.pys in the URL service:

```
def MediaObjectsForURL(url):
    return [ MediaObject(
		container = 'flv',
		audio_channels = 2,
		optimized_for_streaming = True,
		parts = [PartObject(key = Callback(PlayFile, url = url))])
    ]

def PlayFile(url):   
return Redirect(url)
```

---

<div class="post-metadata">

**Author:** ![pradeepkg](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@pradeepkg](https://forums.plex.tv/u/pradeepkg)\
**Post date:** [May 2, 2013, 9:34pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/5 "2013-05-02T21:34:10Z")

</div>

Thanks for the info. I tried to modify the code based on your recommendation with an URL service

I get the error

```
Error loading player:
No playable sources found
```

```
2013-05-02 16:31:25,145 (1700) : INFO (logkit:16) - Playing for URL http://bglive-a.bitgravity.com/ndtv/247lo/live/native
2013-05-02 16:31:25,147 (1700) : WARNING (objectkit:193) - The 'platforms' attribute is deprecated and should not be assigned.
2013-05-02 16:31:25,147 (1700) : WARNING (objectkit:193) - The 'protocols' attribute is deprecated and should not be assigned.
2013-05-02 16:31:25,148 (1700) : DEBUG (services:30) - TAG: Object
2013-05-02 16:31:25,148 (1700) : WARNING (objectkit:193) - Media part has no streams - attempting to synthesize
```

---

<div class="post-metadata">

**Author:** ![meo](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/meo/32/4534_2.png) [@meo](https://forums.plex.tv/u/meo)\
**Post date:** [May 3, 2013, 2:57pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/6 "2013-05-03T14:57:36Z")

</div>

> Thanks for the info. I tried to modify the code based on your recommendation with an URL service
> 
> I get the error
> 
> ```
> Error loading player:
> No playable sources found
> ```
> 
> ```
> 2013-05-02 16:31:25,145 (1700) : INFO (logkit:16) - Playing for URL http://bglive-a.bitgravity.com/ndtv/247lo/live/native
> 2013-05-02 16:31:25,147 (1700) : WARNING (objectkit:193) - The 'platforms' attribute is deprecated and should not be assigned.
> 2013-05-02 16:31:25,147 (1700) : WARNING (objectkit:193) - The 'protocols' attribute is deprecated and should not be assigned.
> 2013-05-02 16:31:25,148 (1700) : DEBUG (services:30) - TAG: Object
> 2013-05-02 16:31:25,148 (1700) : WARNING (objectkit:193) - Media part has no streams - attempting to synthesize
> ```

What regular expression are you using in ServiceInfo.plist? It seems that the URL service function never is called ...

Can you provide a log for the plugin?(the&nbsp;com.plexapp.plugins..log)

---

<div class="post-metadata">

**Author:** ![pradeepkg](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@pradeepkg](https://forums.plex.tv/u/pradeepkg)\
**Post date:** [May 3, 2013, 8:01pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/7 "2013-05-03T20:01:18Z")

</div>

Here is an extract from my channel code

```
def MainMenu():   
    dir = ObjectContainer(title1 = "TEST VIDEOS")        
    dir.add(
        EpisodeObject(
            url = 'http://apni.tv/news/ndtv',
            title = "TEST VIDEO")
    )        

        
    return dir
```

From my URL service code

```
def MediaObjectsForURL(url):
    Log("Playing for URL " + url)
    url = "http://bglive-a.bitgravity.com/ndtv/247lo/live/native"
    return MediaObject(container = 'flv',
                        audio_channels = 2,
                        optimized_for_streaming = True,
                        parts = [PartObject(key = Callback(PlayFile, url = url))]
                        )
       

def PlayFile(url):
    Log("Video URL --- " + url)
    return Redirect(url)
```

And the ServiceInfo.plist, I see in the logs that URL service found for the URL in the plugin logs.

```
<?xml version="1.0" encoding="UTF-8"?>

	URL
	
		DESI
		
			URLPatterns
			
				^http://apni.tv/news/
```

---

<div class="post-metadata">

**Author:** ![mikedm139](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/mikedm139/32/96909_2.png) [@mikedm139](https://forums.plex.tv/u/mikedm139)\
**Post date:** [May 4, 2013, 4:55am UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/8 "2013-05-04T04:55:35Z")

</div>

Quick note: MediaObjectsForUrl() should return a [list], even if it is only one MediaObject. I can’t say that will necessarily solve your problems but, it won’t hurt.

---

<div class="post-metadata">

**Author:** ![pradeepkg](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@pradeepkg](https://forums.plex.tv/u/pradeepkg)\
**Post date:** [May 4, 2013, 2:32pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/9 "2013-05-04T14:32:01Z")

</div>

Thanks Mike, I had the array of MediaObjects first before I removed it.

Meanwhile I found TwitTv channel which is similar to what I am trying to achieve. I found the streaming URL for this site and able to play it on my Plex Media Manager. However on my Roku I get to hear the audio for a few seconds and then it stops. I think I am close to getting this to work.

The UStream based channel plays fine on Roku too. Is it a problem with the stream provider?

```
LIVE_URLS = {
             'NDTV 24x7' : 'http://ndtv.live-s.cdn.bitgravity.com/cdn-live-b7/_definst_/ndtv/live/ndtv247live.smil/playlist.m3u8',
             'Ustream': 'http://iphone-streaming.ustream.tv/ustreamVideo/1524/streams/live/playlist.m3u8'
             }

def MainMenu():   
    oc = ObjectContainer(no_cache=True)
    
    for name in LIVE_URLS.keys():
        oc.add(LiveStream(name))    

    return oc

def LiveStream(hls_provider='Ustream', include_container=False):
    vco = VideoClipObject(
    key = Callback(LiveStream, hls_provider=hls_provider, include_container=True),
    rating_key = LIVE_URLS[hls_provider],
    title = hls_provider,
    items = [
    MediaObject(
                 container = 'flv',
                 audio_channels = 2,
                 optimized_for_streaming = True,                   
                 parts = [
                          PartObject(key=HTTPLiveStreamURL(LIVE_URLS[hls_provider]))
                          ]
                )
             ]
    )
    
    if include_container:
        return ObjectContainer(objects=[vco])
    else:
        return vco
```

---

<div class="post-metadata">

**Author:** ![meo](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/meo/32/4534_2.png) [@meo](https://forums.plex.tv/u/meo)\
**Post date:** [May 4, 2013, 2:32pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/10 "2013-05-04T14:32:11Z")

</div>

Besides the comment from Mikedm139 it looks fine.

It works for my when using PMC, but not in Plex/Web or iOS. I did some digging and found that the Plex/Web client performs a HEAD on the redirected URL(probably to get the MIME type). The strange thing is that the NDTV server responds with '404' not found! In PMC the hint of 'flv' is good enough and satisfies the underlaying FFMPEG which do not perform a HEAD, but instead a GET, and it all works.

It's hard to say where to go from here since the NDTV server is not behaving like it should! (Not found when doing HEAD, return ok when doing GET).

---

<div class="post-metadata">

**Author:** ![pradeepkg](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@pradeepkg](https://forums.plex.tv/u/pradeepkg)\
**Post date:** [May 4, 2013, 2:36pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/11 "2013-05-04T14:36:25Z")

</div>

Thanks Meo, I digged further and found a playlist for the live stream. But again the result was identical in that it works on Plex Media Manager (Web) and not on Roku.

Thanks for guiding me on this, this post will help people in furture trying to do something similar.

---

<div class="post-metadata">

**Author:** ![meo](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/meo/32/4534_2.png) [@meo](https://forums.plex.tv/u/meo)\
**Post date:** [May 4, 2013, 2:44pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/12 "2013-05-04T14:44:39Z")

</div>

> Thanks Meo, I digged further and found a playlist for the live stream. But again the result was identical in that it works on PMC and not on Roku.
> 
> Thanks for guiding me on this, this post will help people in furture trying to do something similar.

When I looked at plugins for examples of HLS some time ago, I think I recall that Roku had problems with m3u8 playlists that had the Windows style end of line,&nbsp;i.e . It will only accept (or maybe the other way around?)

Can't remember which Plex channel it was I saw this in though but it had i fix for it ....

---

<div class="post-metadata">

**Author:** ![pradeepkg](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@pradeepkg](https://forums.plex.tv/u/pradeepkg)\
**Post date:** [May 4, 2013, 3:20pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/13 "2013-05-04T15:20:09Z")

</div>

Excellent point.

I think you are referrinf the this code section in the National Geographic URL Service

[https://github.com/plexinc-plugins/Services.bundle/blob/master/Contents/Service%20Sets/com.plexapp.plugins.nationalgeographic/URL/National%20Geographic/ServiceCode.pys#L106-L131](https://github.com/plexinc-plugins/Services.bundle/blob/master/Contents/Service%20Sets/com.plexapp.plugins.nationalgeographic/URL/National%20Geographic/ServiceCode.pys#L106-L131)

I will try this approach to cleanup the m3u8 playlist

---

<div class="post-metadata">

**Author:** ![pradeepkg](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@pradeepkg](https://forums.plex.tv/u/pradeepkg)\
**Post date:** [May 4, 2013, 4:58pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/14 "2013-05-04T16:58:51Z")

</div>

I checked the playlist.m3u8 in Notepad++ and EOL character shows up as UNIX format which essentially is .

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [May 4, 2013, 11:36pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/15 "2013-05-04T23:36:57Z")

</div>

Hi!

HTTPLiveStreamURL != 'flv'. This could the the source of the problem. If you're using the HTTPLiveStreamURL 'helper' function, you don't have to set container, audio\_codec and video\_codec (they will be set automatically).

---

<div class="post-metadata">

**Author:** ![pradeepkg](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@pradeepkg](https://forums.plex.tv/u/pradeepkg)\
**Post date:** [May 5, 2013, 12:09am UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/16 "2013-05-05T00:09:12Z")

</div>

As per meo's suggestion I replaced all \r from the playlist with and was able to get the video work on Roku.

Sander is there a place that has documentation for helper methods HTTPLiveStreamURL&nbsp; nad WebVideoURL etc.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 20, 2019, 11:23pm UTC](https://forums.plex.tv/t/examples-for-flash-over-http-live-streaming/33633/17 "2019-12-20T23:23:29Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
