Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LiveTV streaming issues outside NL #22

Closed
pradix opened this issue Mar 17, 2017 · 24 comments
Closed

LiveTV streaming issues outside NL #22

pradix opened this issue Mar 17, 2017 · 24 comments

Comments

@pradix
Copy link

pradix commented Mar 17, 2017

Hi,

Before 1st of March everything was working great. Watching TV outside Netherlands (I'm based in Dubai). Since the changes made by you and or NPO on the backend it's not working anymore.
Streaming tv shows are still working great, but watching liveTV is not working.
If I look in the logs what i'm getting back i see the following:

2017-03-17 21:48:00:406 UitzendingGemist[4239:2601290] Could not play live stream (Optional(NPOKit.NPOError.networkError("Could not fetch live stream url (url: https://livestreams.omroep.nl/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8?hash=6b2bf994a10ca639a843f939f66a8d9b&type=jsonp&protection=url) (3)")))

Feedback if you open the url is as follow: This is a protected url but hash incorrect or missing, uri: /index.php/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8?hash=6b2bf994a10ca639a843f939f66a8d9b&type=jsonp&protection=url

If I use the website of NPO.nl everything is working, i'm using a SmartDNS services such as Unotelly
and or Unlocator and I have just tested and everything is working on the website.

This is the same URL if I watch NPO1 on their website:
https://smoote1a.omroep.nl/urishieldv2/l2cm22de7f5c460058cc22a7000000.88799773542a1c83/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8

This is the NPO2 live stream through their website:
https://smoote1a.omroep.nl/urishieldv2/l2cm05c65ef2370058cc235a000000.7c77b08c225fad59/live/npo/tvlive/npo2/npo2.isml/npo2.m3u8

So I think it's something small to fix in the backend of your application. I have installed 1.4.1 version

@4np
Copy link
Owner

4np commented Mar 21, 2017

I have pushed a couple of changes to the logic that fetches the live stream urls that -i think- could solve the issues you are having. Can you please try again with the latest code and see if it solves the issues you are having?

@4np
Copy link
Owner

4np commented Mar 22, 2017

I just released 1.5.0 which brings several video stream improvements and adds support for closed captioning.

@4np
Copy link
Owner

4np commented Mar 25, 2017

@pradix : Did you manage to test the latest release? Are things working properly for you now?

@pradix
Copy link
Author

pradix commented Mar 25, 2017

Can't look into it now I'm traveling. I'm back on Monday and will test it. Thank you!!

@4np
Copy link
Owner

4np commented Mar 25, 2017

Cool, thanks! Happy traveling :)

@pradix
Copy link
Author

pradix commented Mar 27, 2017

I have tested, but didn't solve the problems.
In logs i get: 2017-03-27 13:18:52.049 UitzendingGemist[11692:5024041] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9824)

This is the link on the website of NPO that's working at the moment what i'm using with SmartDNS server: https://smoote1d.omroep.nl/urishieldv2/l2cm8da084a61c0058d8daa5000000.f5efc6d1721a0c10/live/npo/tvlive/npo2/npo2.isml/npo2.m3u8

In previous version 1.4 i still could even watch programs outside Netherlands, now you have blocked that option. I'm using smartDNS server Unlocator and Unotelly. If it's needfull i can share it in private message my account.

Everyhing on the iPad works fine with the NPO app.

@4np
Copy link
Owner

4np commented Mar 27, 2017

That's not the news I was expecting, can you do some more debugging on your end? The tvOS app is actually using those URLs you are seeing :) If you use Chrome's network debugger getting the URL is actually a three-step process. For example:

Go to an episode

For example to this episode

Inspect the requests and search for the one that returns the different video content types (the app is currently always using the adaptive one)

step1

Inspect the JSONP request to the adaptive playlist

step2and3

That will lead to the final playlist that the video player will use

step3

Note that the app will currently perform a different call for step 2 getting rid of the jsonp and callback parameters which will immediately return the result from step 3. So right now, the app uses two requests to obtain the video playlist.

Another thing to try...

The App will now use stream types in order of preference. You can try to change the order like described here. Perhaps that will allow you to pinpoint the issue?

@pradix
Copy link
Author

pradix commented Mar 27, 2017

Floortje was not geo blocked so already working.
It's the live streaming that is not working and i can't play for now the geo blocked episodes (maybe you can make the play button still clickable)

@pradix
Copy link
Author

pradix commented Mar 27, 2017

I disabled the geo restrictions on my side in your app...all the streams are working. The only thing that's not working is the live streams. In de debugging it give it's paused. I have played around with the quality, that don't make any difference. For the normal streams the adaptive is even playing!
So the only issue i have is live streaming (on the NPO site it's working)

@4np
Copy link
Owner

4np commented Mar 27, 2017

Aha, it was not clear from your previous post that the episodes with no-region validation were still playing as expected but that those that did have region limitation did not play. To re-enable the button (basically ignoring the region check) you can change this line as follows:

playButton.isEnabled = true //canPlay

I would suspect that those episodes that are marked to have region limitation will still not play, even if you enable the button. It might be similar for those live feeds, perhaps they are regionally limited now as well.

Regarding Unlocator, their FAQ states the following:

Unlike traditional VPN tunnels we only redirect the traffic responsible for geographic detection. 

To me, that sounds very unlikely / too good to be true. Whenever you connect to a streaming video server, your IP is known or they have to route the video stream through their VPN (which they say they don't).

@pradix
Copy link
Author

pradix commented Mar 27, 2017

I looked in your source code NPOManager+Streams.swift:

This is the url that i got on chrome while i'm watching NPO1 Live:
https://ida.omroep.nl/app.php/LI_NL1_4188102?adaptive=no&token=pd91k0014qft7caaju725282v1
with output:
{"limited":false,"site":null,"items":[[{"label":"Live","contentType":"live","url":"https://livestreams.omroep.nl/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8?hash=5a358f2d687806d71c273113d4344b15&type=jsonp&protection=url","format":"hls"}]]}

@4np
Copy link
Owner

4np commented Mar 27, 2017

The geo check that determine whether or not the play button is enabled is using an open source project. What country does this url report back to you?

@pradix
Copy link
Author

pradix commented Mar 27, 2017

I found the solution: it's the token that is wrong: if i change the token: pd91k0014qft7caaju725282v1
Than it's working
https://ida.omroep.nl/app.php/LI_NL2_4188105?adaptive=no&token=pd91k0014qft7caaju725282v1
This was the output from your app - token: 40b25u9q5bc3pe7aovv94u75m2
https://ida.omroep.nl/app.php/LI_NL2_4188105?adaptive=yes&token=40b25u9q5bc3pe7aovv94u75m2

@4np
Copy link
Owner

4np commented Mar 27, 2017

That's strange, as the token has a lifetime of 2 hours (7200 seconds, that app expires the token sooner in 1 hour). What happens if you set the token lifetime to 0 in this file?

I am unable to open the URLs you posted:

{
"error": "Access denied"
}

It looks like the token is based on your IP address... Perhaps that is causing the issue?

@pradix
Copy link
Author

pradix commented Mar 27, 2017

makes no difference.
only weird thing is:
when I use https i get this as output:
(Optional(NPOKit.NPOError.networkError("Could not fetch stream for video model (url: https://ida.omroep.nl/app.php/LI_NL1_4188102?adaptive=yes&token=0ae9va9b2o9m5dcit0ah6eag31)")))
if i copy the link in browser and remove the https and replace it with http, it's working.
http://ida.omroep.nl/app.php/LI_NL1_4188102?adaptive=yes&token=0ae9va9b2o9m5dcit0ah6eag31
When i change it back in the code to http. than it's not working.
i have feeling we are almost there ;-)

@4np
Copy link
Owner

4np commented Mar 27, 2017

Hmm, it seems like my comment says https while the url says http... in general I should really get rid of the http and only use https whenever possible. Apple has been allowing it but they will most likely kill the non-secure transports altogether sooner than later.

@pradix
Copy link
Author

pradix commented Mar 27, 2017

What can we do to fix this issue? i need to watch Studio Sport on Sunday ;-)

@4np
Copy link
Owner

4np commented Mar 27, 2017

Hahahahaha :D

@pradix
Copy link
Author

pradix commented Mar 27, 2017

I'm not getting any error in the debugger, but only that it's paused, even when i try to play with the order of the video quality:
2017-03-27 23:06:42:827 UitzendingGemist[19233:5360228] Debugging episode video player is enabled
2017-03-27 23:06:42:839 UitzendingGemist[19233:5360228] Player is now waiting to play at the specified rate
2017-03-27 23:07:02:904 UitzendingGemist[19233:5360228] Player is now paused

@pradix
Copy link
Author

pradix commented Mar 27, 2017

i tried to add you on skype...that talk quicker

@4np
Copy link
Owner

4np commented Mar 27, 2017

I just pushed another change and I changed all URLs from http to https. The back-end did not use https and looking at the certificate they added https support in dec 2016. Probably to prepare for Apple closing down on http resources...

4np added a commit that referenced this issue Mar 27, 2017
…ransport (https - enabled by default) or not. Note that this does not impact any stream url that are retreived from the back-end, the Youtube resources or the version check (which only exist on https). #22
4np added a commit that referenced this issue Mar 27, 2017
4np added a commit that referenced this issue Mar 27, 2017
4np added a commit that referenced this issue Mar 27, 2017
@4np
Copy link
Owner

4np commented Mar 27, 2017

Finally we managed to solve the issue :D

@pradix
Copy link
Author

pradix commented Mar 27, 2017

Thanks for all your support

@4np 4np closed this as completed Mar 28, 2017
@4np
Copy link
Owner

4np commented Apr 10, 2017

Finalized support in the 1.5.1 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants