e2openplugin-OpenWebif icon indicating copy to clipboard operation
e2openplugin-OpenWebif copied to clipboard

Streaming IPTV Channels from Kodi

Open phunkyfish opened this issue 6 years ago • 33 comments

Hey,

I've recently added support to the kodi pvr addon for Enigma2 to be able to play live IPTV streams. It's simply extracts the IPTV stream URL from the service reference and passes it to kodi.

Here's an example sRef: 1:0:1:909:63:27:FFFF0000:0:0:0:http%3a//my.iptvprovider.net%3a8000/live/channels/mychannel.ts

However this means the experience is different to DVB channels in that you can't use timeshift etc., you can only stop or record.

Would it be possible to stream these channels like other channels through OpenWebIf so the same feature set can be experienced regardless of channel type?

Thanks in advance.

Note: The majority of images now support viewing/timeshifting of IPTV.

phunkyfish avatar Sep 14 '19 14:09 phunkyfish

@jbleyel any thoughts on the above?

phunkyfish avatar Sep 20 '19 06:09 phunkyfish

Any update?

phunkyfish avatar Oct 12 '19 16:10 phunkyfish

What's the exact issue? Do you have a problem with openwebif?

jbleyel avatar Nov 01 '19 10:11 jbleyel

Yes, if I try to open a stream whose sRef contains an IPTV url as above the stream does not open. Let me post some examples.

phunkyfish avatar Nov 01 '19 10:11 phunkyfish

Where exactly do you open this stream?

jbleyel avatar Nov 01 '19 10:11 jbleyel

I open the stream from Kodi. For a regular channel I would stream this a URL like this:

http://192.168.1.201:8001/1:0:2:1932:7FF:2:11A0000:0:0:0

But for IPTV I try to stream a URL like this but it fails:

http://192.168.1.201:8001/1:0:1:909:63:27:FFFF0000:0:0:0:http%3a//my.iptvprovider.net%3a8000/live/channels/mychannel.ts

phunkyfish avatar Nov 01 '19 10:11 phunkyfish

This needs to do in Kodi because you are getting only the channel refs. I don't want modify the srefs.

jbleyel avatar Nov 01 '19 10:11 jbleyel

Can you explain a bit more? I.e. how I should modify the sRef so it would work?

phunkyfish avatar Nov 01 '19 11:11 phunkyfish

I had assumed that the channelRef was the sRef.

phunkyfish avatar Nov 01 '19 11:11 phunkyfish

You can use this small check sref starts with 4097: or 5002: or sref contains :http%3a or :https%3a

jbleyel avatar Nov 01 '19 11:11 jbleyel

Ok, so if it’s any of those 3 types what should I do differently?

What I have noticed is that I can stream from kodi if I also play the channel directly on the receiver. But if I stop playing on the receiver it will stop on kodi. I’m wondering if a change is needed on Enigma2 to enable this.

@AbuBaniaz - any thoughts?

phunkyfish avatar Nov 01 '19 11:11 phunkyfish

If you detect IPTV you need to remove the sref and start the stream directly.

1:0:1:909:63:27:FFFF0000:0:0:0:http%3a//my.iptvprovider.net%3a8000/live/channels/mychannel.ts

Remove 1:0:1:909:63:27:FFFF0000:0:0:0: Replace %3a with : and play directly

jbleyel avatar Nov 01 '19 12:11 jbleyel

Sorry, I think our wires got crossed. This I already do from the kodi addon. It works however as kodi handles the stream it’s not possible to timeshift.

As stated in my previous post I can however stream this URL from kodi so timeshift will work:

http://192.168.1.201:8001/1:0:1:909:63:27:FFFF0000:0:0:0:http%3a//my.iptvprovider.net%3a8000/live/channels/mychannel.ts

But this will only work if the Enigma2 is also viewing the same stream.

The intention is to be able to timeshift an IPTV stream whether you view it directly on the Enigma2 device or via the Kodi PVR addon.

phunkyfish avatar Nov 01 '19 14:11 phunkyfish

This sounds like a enigma2 limitation and therefore not openwebif related.

jbleyel avatar Nov 01 '19 15:11 jbleyel

I agree. I think once fixed on Enigma2 OpenWebIf will just work.

phunkyfish avatar Nov 01 '19 15:11 phunkyfish

You can use this small check sref starts with 4097: or 5002: or sref contains :http%3a or :https%3a

DVB service references start with 1. If it does not start with 1, it is a stream fields[0] != '1':

AbuBaniaz avatar Nov 01 '19 18:11 AbuBaniaz

NO!! This is also a valid IPTV ref 1:0:1:909:63:27:FFFF0000:0:0:0:http%3a//my.iptvprovider.net%3a8000/live/channels/mychannel.ts

jbleyel avatar Nov 01 '19 18:11 jbleyel

Yes, you are right

Athoik committed this which might be better method. https://github.com/OpenPLi/enigma2/commit/8831e3ab1100449d627ff5d2b62ca556ee07d541

AbuBaniaz avatar Nov 01 '19 18:11 AbuBaniaz

Great, and do you think that is why the stream won't start via openwebif?

Happy to test it once it appears as a Vix update.

phunkyfish avatar Nov 01 '19 19:11 phunkyfish

I don't know, sorry.

Doesn't OWIF not have a debug you can check?

AbuBaniaz avatar Nov 01 '19 20:11 AbuBaniaz

This is what is in the standard enigma log:

< 36920.123> [eDVBServiceStream] stream ref: 1:0:1:909:63:27:FFFF0000:0:0:0:http://my.iptvprovider.net:8000/live/channels/mychannel.ts
< 36920.124> [eDVBResourceManager] allocate channel.. 0000:0000
< 36920.124> [eDVBResourceManager] available channel.. 0802:0002
< 36920.124> [eDVBResourceManager] channel not found!
< 36920.124> [eDVBServicePMTHandler] allocate Channel: res -5
< 36920.124> [eDVBServiceStream] STREAM service event 10
< 36920.124> [eDVBServiceStream] stop streaming m_state 1

phunkyfish avatar Nov 01 '19 21:11 phunkyfish

If it's already playing on E2 device and it streams to kodi:

 37174.633> [eDVBServiceStream] stream ref: 1:0:1:909:63:27:FFFF0000:0:0:0:http://my.iptvprovider.net:8000/live/channels/mychannel.ts
< 37174.633> [eDVBResourceManager] allocate channel.. 0000:0000
< 37174.633> [eDVBResourceManager] available channel.. 0000:0000
< 37174.633> [eDVBResourceManager] found shared channel..
< 37174.633> [eDVBServicePMTHandler] allocate Channel: res 0
< 37174.633> [eDVBCIInterfaces] addPMTHandler 1:0:1:909:63:27:FFFF0000:0:0:0:
< 37174.633> [eDVBChannel] getDemux cap=01
< 37174.633> [eDVBServicePMTHandler] ok ... now we start!!
< 37174.633> [eDVBDemux] open demux /dev/dvb/adapter0/demux22

phunkyfish avatar Nov 01 '19 21:11 phunkyfish

To me this usage can be described as a man in the middle approach. You are trying to make E2 play the stream so you can timeshift it on Kodi. When you stream a DVB item, DVB resources are being used on the receiver. If E2 does not have to use DVB resources, it won't play it, it will just refer it.

Your description suggests that the referral is being done.

It is and illogical approach to uses resources when you don't need to.

AbuBaniaz avatar Nov 03 '19 20:11 AbuBaniaz

All this makes the assumption that the streams are viewed directly on the receiver. My receiver is purely used as a stream server I only view it directly when modifying settings. Many users use their receivers this way now.

I think it’s fair to support that use case.

phunkyfish avatar Nov 07 '19 09:11 phunkyfish

I disagree.

People are likely to watch FTA and streams on their receiver. Not use their E2 boxes just as referrers.

What's the point having the box if you are not using it other than to provide a service reference for another device to use. No viewing, no recording.

Anyway everyone uses their boxes differently. Best to accommodate as many people as possible.

AbuBaniaz avatar Nov 07 '19 18:11 AbuBaniaz

I think that’s the key point. Many users have evolved the way they use their devices. I see more and more users who use every function and more of their E2 device using OpenWebIf as the remote API.

The API can be enriched with the likes of the kodi addon adding features that were previously unavailable.

phunkyfish avatar Nov 07 '19 19:11 phunkyfish

Hi @phunkyfish , i don't understand your real problem. You are want to stream a IPTV via openwebif directly on a PC or other device. This function is implemented already.

jbleyel avatar Nov 07 '19 20:11 jbleyel

Then we go back to the original point jebyel made.

You are playing back the stream using Kodi. All you want is the stream details from the receiver. Receiver just hosts the list of streams.

IMO this is an OWIF issue, not E2.

What I gather you are saying is as follows: Kodi playing stream directly does not allow pausing.

You must use E2 as a man in the middle attack to facilitate the pausing.

If this is correct, we need a function in OWIF to stream out and play in background on E2.

AbuBaniaz avatar Nov 07 '19 20:11 AbuBaniaz

Yes, I believe that is correct @AbuBaniaz

@jbleyel is this possible?

phunkyfish avatar Nov 07 '19 21:11 phunkyfish

I have no idea how to implement this.

jbleyel avatar Nov 08 '19 15:11 jbleyel