Plex Media Server plugin that plays live streams (a.k.a. IPTV) from a M3U playlist

Plex Media Server plugin that plays live streams (a.k.a. IPTV) from a M3U playlist

by Valdas Vaitiekaitis, also known as Cigaras, version 1.0.10

Introduction
Installation
Playlist structure and examples
Compatible devices and limitations
Supported protocols
Troubleshooting
To do list
Credits and contacts
License
Introduction

Some ISP provide their users IPTV services, that can be watched over VLC on PC or on TV sets, but for TV a Set-top box is usually required that is both expensive and inconvenient because of separate remote. MediaLink, that is pre-installed on most LG TVs, is able to play IPTV streams with the help of Plex Media Server, but it does not has native support for it. One simple solution is to put every single stream url into a separate *.strm file, load them into Plex library as Home Videos and assign logos and descriptions manually. Or, if You are lucky, You might find a Channel with predefined playlist that suits Your needs or even broadcasts IPTV from Your ISP, but as I was not lucky enough, I decided to take matters into my own hands and created this Channel plugin, that allows to watch network streams from a customisable playlist, thus allowing You to watch IPTV without a Set-top box!

Please read further for instructions on how to install and configure this plugin, check compatible devices and supported protocols, and, if You find my work useful, please consider a small donation as a sign of gratitude and support.

Installation

Must have Plex Media Server installed, obviously;
Download the zip archive and extract it to Plex plugin folder, for more details read the official channel installation guide:
on Windows: C:\Users\USERNAME\AppData\Local\Plex Media Server\Plug-ins
on Mac: ~Library/Application Support/Plex Media Server/Plug-ins
on Linux: /usr/lib/plexmediaserver/Resources/Plug-ins or /var/lib/plex/Plex Media Server/Plug-ins
on FreeBSD usr/pbi/plexmediaserver-amd64/plexdata/Plex\ Media\ Server/Plug-ins/
Rename folder from IPTV.bundle-master to IPTV.bundle;
Edit the playlist, read below for instructions and limitations;
Restart the Plex Media Server;
Launch any of Plex Apps (that is connected to the server, obviously) and you should see a new category in Your media library called Video Channels or similar, read below for compatibility and limitations.
Playlist structure and examples

Sample playlist is located in IPTV.bundle\Content\Resources\playlist.m3u, you can specify other filename in preferences, but You can not change the path to it, only name can be changed.

Online playlist is also supported, You just need to specify a direct link to it, with http part included (like http://cigaras.tk/test.m3u). Playlist should be encoded in UTF-8 without BOM, I recomend using Notepad++ to check and convert if needed.

Included sample playlist is for testing purposes only, some streams might be dead by now, here is a short list of resources to get started, however please keep in mind, I am not associated with them and not responsible for their content, try it at Your own risk:

FreeTuxTv.net
IPTV-Player.com
HasBahCaIPTV.com
IPTV-Tv.blogspot.com
TvOnlineStreams.com
Plex forums
Google.com
Playlist supports additional attributes that can be optionally defined inline after #EXTINF:0 and before the name of the media:

group-title - category name;
tvg-logo, logo - stream logo or icon, can use remote media (url must include http part) or stored images from \IPTV.bundle\Content\Resources folder (filename must include extension);
tvg-id - not used at the moment, will be used for EPG;
tvg-name - not used at the moment, will be used for EPG.
A simple example (see included sample playlist for more):

#EXTM3U
#EXTINF:0 tvg-name="Cartoon Network" tvg-id="Cartoon Network" tvg-logo="icon-default.png" group-title="Cartoons",Cartoon Network
http://80.87.146.133:1111/udp/230.3.3.112:5678
#EXTINF:-1 tvg-logo="http://img3.wikia.nocookie.net/__cb20130406103153/logopedia/images/thumb/0/0f/MTV_Logo_2010.svg/200px-MTV_Logo_2010.svg.png" group-title="Music",MTV Dance
http://80.87.146.133:1111/udp/230.3.3.115:5678
Read further for more information about supported protocols and required configurations.

Compatible devices and limitations

It is a known fact that Plex Media Server does not transcode live streams and leaves this job for clients and streaming sources, so streams will play only on clients that are able to handle the stream natively:

Desktop Clients:
Plex Media Center - no longer in production but you can get one from old Plex Wiki page Plex Downloads Archive or download.cnet.com, plays most streams without problems, latest known version 0.9.5.4;
Plex Home Theater - the new Plex Media Center, does not play any streams at all;
Plex Web - most streams do not work, needs testing;
Connected Devices:
Plex for LG TV (MediaLink) plays HTTP and RTSP streams, however MediaLink is not included in most 2013 years TV models so it can be a problem, Simon J. Hogan is working on a Plex client for LG Smart TV, however I did not test it;
PlexConnect (Apple TV) - many users report that it does work, You just need to alternate between transcoding options, or use third party transcoding service;
Plex for Roku - for some it works, for some it does not, wheezycheezel posted step by step guide for TVHeadend streams on Plex forums, needs more testing;
Plex for Chromecast - not tested;
Plex for Google TV - not tested;
Plex for Samsung - not tested;
Mobile Devices:
Plex for Android - usualy does not work, should work with external player like MX Player, needs testing;
Plex for iOS - at the moment does not play any streams at all;
Plex for Windows Phone - not tested;
Keep in mind that following list is not full because Plex developers are constantly working and updating their software and I do not have the resources to test them all, You can easily test your client by putting stream url into a *.strm file and loading it into Plex as Home Video as mentioned above and below, please contact me if it happens to work on Your device that is listed as not working or unknown.

Also You can try running a dedicated transcoding service and get Your streams in preferable format, VODServer is a good and free example.

One more flaw of this plugin is that it has no control over audio tracks if stream has multiple. Some clients can change the track, some can not, but plugin can not predefine one and I have no solution at the moment.

Read further for specific configuration required for some streaming protocols.

Supported protocols

HTTP should work on most devices natively, no specific configuration required.

RTSP should work on most devices natively, no specific configuration required.

RTMP requires special Framework Flag that makes plugin incompatible with some older devices/clients (like my TV) and is disabled by default. You can enable it in Preferences, but You need to manually uncomment 14th line in Info.plist file for RTMP streams to work: find and change it to UseRealRTMP.

As Plex no longer supports webkit players, You can no longer use full RTMP urls like this:

rtmp://shopnbc.fmsls.entriq.net:443/live/ playpath=live_01@13361 swfurl=http://shopnbc.img.entriq.net/img/ShopNBCLivePlayer/main.swf pageurl=http://www.shopnbc.com/
You can only use single URL address without attributes, for example:

rtmp://shopnbc.fmsls.entriq.net:443/live/live_01@13361
If Real RTMP option in preferences is disabled, plugin will try to play stream over HTTP protocol, some streams work that way. If Real RTMP option is enabled, but UseRealRTMP flag in Info.plist file is disabled, then Plex will try to use its own hosted SWF player and will fail.

MMS did not work for me on any tested devise, but plugin will try to play MMS videos over HTTP protocol.

Keep in mind that all streams are unique and Plex will not be able to play all of them, but not necessary because of plugins fault (read Compatible devices and limitations). Please try playing stream with VLC and using *.strm file method described above and below before blaming this plugin. If *.strm method works and plugin does not, please contact me.

Troubleshooting

If You encounter errors or some streams do not work please do the following:

Make sure the playlist file is encoded in UTF-8 without BOM;

Try to play the stream in VLC player, if it fails Your stream is invalid and will not play on any device; if it works continue to next step:

Create a new file with notepad, write your desired streams url there and save it with *.strm extension, put it into a folder and load folder into Plex Server as Home Video, try to play it in Plex client, if it fails, Your client is unable to play this stream, try alternative clients; if it works, continue to next step:

Check plugin log file com.plexapp.plugins.iptv.log located in the folowing folder:

on Windows: C:\Users\USERNAME\AppData\Local\Plex Media Server\Logs\PMS Plugin Logs\
on Mac: ~Library/Application Support/Plex Media Server/Logs/PMS Plugin Logs/
If You do not have a solution after checking the log file, submit a ticket on GitHub or post on Plex forum with log and playlist files attached and I will try to help You.

To do list

EPG;
Get rid of the list variable and sort the dictionary;
Possibility to predefine audio track, if ever becomes possible;
MMS protocol troubleshooting;
Use Plex Services.
Credits and contacts

Developer: Valdas Vaitiekaitis, also known as Cigaras;
Contributors: supergivi, sander1, and many others;
Artwork by photographer D. Sharon Pruitt, owner of Purple Sherbet Photography, licensed under CC Attribution 2.0;
Icons by artist Paul Davey, also known as Mattahan, licensed under CC Attribution-Noncommercial-Share Alike 3.0;
Advisors: shopgirl284, Mikedm139.
If You have any questions or suggestions, please feel free to contact me via GitHub or Plex forum, or, if You are Lithuanian, please visit my personal blog at www.Cigaras.tk. If You find my work useful, please consider a small donation as a sign of gratitude and support.

License

Copyright © 2013-2015 Valdas Vaitiekaitis

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.