NRKTV.bundle icon indicating copy to clipboard operation
NRKTV.bundle copied to clipboard

LiveTV not working

Open frostmo84 opened this issue 12 years ago • 26 comments

error message: "cannot load m3u8: cross-domain access denied"

frostmo84 avatar May 24 '13 13:05 frostmo84

Thanks for reporting. Pull request #3 should hopefully fix most of the bugs with the current version. Will try to pull this in tonight.

eithe avatar May 28 '13 11:05 eithe

Merged #3 and it should be working again.

eithe avatar May 28 '13 19:05 eithe

Hmm, again not working...

meulie avatar Jun 20 '13 17:06 meulie

Ok, I'll take a look at it .. They are always changing those URLs ...

eithe avatar Jun 21 '13 07:06 eithe

In case other devs see this, the new urls to the m3u8s seems to be:

http://nrk1us-f.akamaihd.net/i/nrk1us_0@102847/master.m3u8?dw=31
http://nrk2us-f.akamaihd.net/i/nrk2us_0@107231/master.m3u8?dw=31
http://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/master.m3u8?dw=31

eithe avatar Jun 21 '13 08:06 eithe

Thanks :-)

Hmm, how do I implement this in the code...?

meulie avatar Jun 21 '13 10:06 meulie

The API is generating the URLs from the sent user-agents in the request (i.e. Mobile Safari user-agents returns HLS streams, Chrome desktop returns .f4m).

image

johnkors avatar Nov 04 '13 11:11 johnkors

@johnkors What URL are you querying to get that JSON?

nemzes avatar Nov 15 '13 12:11 nemzes

@nelsonmenezes http://v7.psapi.nrk.no/mediaelement/{programid}

johnkors avatar Nov 15 '13 12:11 johnkors

Just a note to where we always can get updated live urls: http://v7.psapi.nrk.no/mediaelement/nrk1

eithe avatar Nov 23 '13 13:11 eithe

Yes, and that's the source I'm using, but only get errors. Maybe you can have a look at the service code?

lørdag 23. november 2013 skrev Eirik H følgende:

Just a note to where we always can get updated live urls: http://v7.psapi.nrk.no/mediaelement/nrk1

— Reply to this email directly or view it on GitHubhttps://github.com/eithe/NRKTV.bundle/issues/2#issuecomment-29132593 .

Erling Brandvik +4790851110

burnbay avatar Nov 23 '13 15:11 burnbay

@burnbay I just downloaded the latest source from this rep. and your Live code seems to work quite well here. This is on latest PMS and PHT plexpass releases!

eithe avatar Nov 23 '13 17:11 eithe

Live TV works on latest PHT and Plex/Web, considering closed! However, it does not work on Android, but I think that is to be expected because it's HLS. I will add another issue for this.

eithe avatar Nov 25 '13 21:11 eithe

Wanted to watch the horse VM, today on NRK2. Cannot load M3U8: 404 not found. Removed the channel, installed again, checked for updates, restarted Plex. Now I get AES decryption not supported in Premium edition.... ?

thesatman avatar Aug 30 '14 14:08 thesatman

@thesatman Which client and server is this? I don't have the time to look into it, but in case anyone else is watching, I found https://forums.plex.tv/index.php/topic/108837-error-aes-decryption-not-supported-in-premium-edition/

eithe avatar Sep 01 '14 06:09 eithe

Running the latest Windows PMS 0.9.9.14 (latest update). Clients I have tried are the web gui on Windows Chrome and Roku Wireless USB stick..

thesatman avatar Sep 01 '14 08:09 thesatman

Hi,

Looks like Eirik's link is the answer to the web GUI. As for the Roku stick, it's difficult to say. I have a Roku 3 myself, and it's working. Need to have a look at your PMS logs (nrk plugin) to investigate more.

Erling

On Mon, Sep 1, 2014 at 10:11 AM, thesatman [email protected] wrote:

Running the latest Windows PMS 0.9.9.14 (latest update). Clients I have tried are the web gui on Windows Chrome and Roku Wireless USB stick..

— Reply to this email directly or view it on GitHub https://github.com/eithe/NRKTV.bundle/issues/2#issuecomment-54032436.

Erling Brandvik +4790851110

burnbay avatar Sep 08 '14 10:09 burnbay

OK, In other words, Forget about NRK in the web client. But since you mentioned that it works on your Roku3 I decided to give it another go. I tested the live channels and got always the same error "Video unavailable, unable to play, etc ...". Until suddenly a live feed came through. Just for only a few seconds, then buffering, then error.

 

In the com.plexapp.system log I see that the bits and pieces (video fragments) are loaded :

2014-09-08 20:03:19,920 (10d0) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.system/serviceFunction/url/com.plexapp.plugins.nrk/NRK-Live/ContentOfURL?args=Y2VyZWFsMQoxCnR1cGxlCjAKcjAK&kwargs=Y2VyZWFsMQoxCmRpY3QKMgpzMTcxCmh0dHBzOi8vbnJrMnVzLWYuYWthbWFpaGQubmV0L2kvbnJrMnVzXzBAMTA3MjMxL2NyeXB0LWIua2V5P3NkPTEwJnJlYmFzZT1vbiZlPTEmaWQ9QWdCWkM2WXN3ZFN5eDFydkRWUmt3RXlmTVA1MExPWTRkWTJtTzBOWHRKSUg0eUw2JTJmbW9rdWRpRm44bUU2cmwzYTIlMmZpMTFpTkpQNE90USUzZCUzZHMzCnVybHMzMQpfYWxpZF89OWtTczEvbVZSSm5vMWNtaDQ2WGNZQT09czcKY29va2llc3IwCg__

2014-09-08 20:03:19,924 (10d0) :  DEBUG (runtime:49) - Received packed state data (80 bytes)

2014-09-08 20:03:19,926 (10d0) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.system/serviceFunction/url/com.plexapp.plugins.nrk/NRK-Live/ContentOfURL

2014-09-08 20:03:19,927 (10d0) :  DEBUG (runtime:49) - Received packed state data (80 bytes)

2014-09-08 20:03:19,930 (10d0) :  DEBUG (networking:172) - Requesting 'https://nrk2us-f.akamaihd.net/i/nrk2us_0@107231/crypt-b.key?sd=10&rebase=on&e=1&id=AgBZC6YswdSyx1rvDVRkwEyfMP50LOY4dY2mO0NXtJIH4yL6%2fmokudiFn8mE6rl3a2%2fi11iNJP4OtQ%3d%3d'

2014-09-08 20:03:20,127 (10d0) :  DEBUG (runtime:106) - Sending packed state data (99 bytes)

2014-09-08 20:03:20,128 (10d0) :  DEBUG (runtime:918) - Response: [200] str, 16 bytes

2014-09-08 20:03:20,535 (9a8) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.system/serviceFunction/url/com.plexapp.plugins.nrk/NRK-Live/ContentOfURL?args=Y2VyZWFsMQoxCnR1cGxlCjAKcjAK&kwargs=Y2VyZWFsMQoxCmRpY3QKMgpzMTg4Cmh0dHA6Ly9ucmsydXMtZi5ha2FtYWloZC5uZXQvaS9ucmsydXNfMEAxMDcyMzEvc2VnbWVudDE0MTAxOTg5NV8zNTI4X2F2LWIudHM%40c2Q9MTAmcmViYXNlPW9uJmU9MSZpZD1BZ0JaQzZZc3dkU3l4MXJ2RFZSa3dFeWZNUDUwTE9ZNGRZMm1PME5YdEpJSDR5TDYlMmZtb2t1ZGlGbjhtRTZybDNhMiUyZmkxMWlOSlA0T3RRJTNkJTNkczMKdXJsczMxCl9hbGlkXz05a1NzMS9tVlJKbm8xY21oNDZYY1lBPT1zNwpjb29raWVzcjAK

2014-09-08 20:03:20,539 (9a8) :  DEBUG (runtime:49) - Received packed state data (80 bytes)

2014-09-08 20:03:20,540 (9a8) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.system/serviceFunction/url/com.plexapp.plugins.nrk/NRK-Live/ContentOfURL

2014-09-08 20:03:20,542 (9a8) :  DEBUG (runtime:49) - Received packed state data (80 bytes)

2014-09-08 20:03:20,628 (9a8) :  DEBUG (networking:172) - Requesting 'http://nrk2us-f.akamaihd.net/i/nrk2us_0@107231/segment141019895_3528_av-b.ts?sd=10&rebase=on&e=1&id=AgBZC6YswdSyx1rvDVRkwEyfMP50LOY4dY2mO0NXtJIH4yL6%2fmokudiFn8mE6rl3a2%2fi11iNJP4OtQ%3d%3d'

 

So I guess the limitation is the bandwidth? We are blessed with a 2 Mbps ADSL line. Could this be a typical behaviour (eror, error, play, error, ...) for low internet speeds for streaming? Youtube tends to go OK, but NRK is sending HD or ?

thesatman avatar Sep 08 '14 18:09 thesatman

I think you're onto something. The live streams are all over SSL, and some clients don't support that (Roku among others). In order to fix that, we need to patch the playlist (m3u8). First of all we read the original m3u8 and pick the highest bitrate (lazy, I know). I guess we can add a bitrate setting for the plugin so that the proper stream gets picked. The original playlist looks like this:

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=164000,RESOLUTION=320x180,CODECS="avc1.66.30, mp4a.40.2" https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_164_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=164000,RESOLUTION=320x180,CODECS="avc1.66.30, mp4a.40.2" https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_164_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=264000,RESOLUTION=480x270,CODECS="avc1.66.30, mp4a.40.2" https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_264_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=264000,RESOLUTION=480x270,CODECS="avc1.66.30, mp4a.40.2" https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_264_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=464000,RESOLUTION=640x360,CODECS="avc1.66.30, mp4a.40.2" https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_464_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=464000,RESOLUTION=640x360,CODECS="avc1.66.30, mp4a.40.2" https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_464_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=928000,RESOLUTION=640x360,CODECS="avc1.77.30, mp4a.40.2" https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_928_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=928000,RESOLUTION=640x360,CODECS="avc1.77.30, mp4a.40.2" https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_928_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1428000,RESOLUTION=960x540,CODECS="avc1.77.30, mp4a.40.2" https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_1428_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1428000,RESOLUTION=960x540,CODECS="avc1.77.30, mp4a.40.2" https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_1428_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1928000,RESOLUTION=960x540 https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_1928_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1928000,RESOLUTION=960x540 https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_1928_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2728000,RESOLUTION=1280x720 https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_2728_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2728000,RESOLUTION=1280x720 https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_2728_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3528000,RESOLUTION=1280x720 https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_3528_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3528000,RESOLUTION=1280x720 https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_3528_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_3528_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=64000,CODECS="mp4a.40.2" https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_164_a-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=64000,CODECS="mp4a.40.2" https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_164_a-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d

All links are also HTTPS and new playlists. The picked playlist contains the actual video segments and encryption information:

#EXT-X-KEY:METHOD=AES-128,URI="https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/crypt-b.key?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/crypt-b.key?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d",IV=0xb3aa051776ddb03d2b2457d6960a2532

I guess that line breaks the web client.

If you go to line 140 in ServiceCode.pys located in C:\Users\AppData\Local\Plex Media Server\Plug-ins\NRKTV.bundle\Contents\Services\URL\NRK-Live (windows) and change the line from:

sorted_streams = sorted(streams, key = lambda stream: stream["bitrate"], reverse = True)

to

sorted_streams = sorted(streams, key = lambda stream: stream["bitrate"], reverse = False)

you should get the lowest bitrate. Give it try and let me know how it goes :)

Erling

On Mon, Sep 8, 2014 at 8:27 PM, thesatman [email protected] wrote:

OK, In other words, Forget about NRK in the web client. But since you mentioned that it works on your Roku3 I decided to give it another go. I tested the live channels and got always the same error "Video unavailable, unable to play, etc ...". Until suddenly a live feed came through. Just for only a few seconds, then buffering, then error.

In the com.plexapp.system log I see that the bits and pieces (video fragments) are loaded :

2014-09-08 20:03:19,920 (10d0) : DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.system/serviceFunction/url/com.plexapp.plugins.nrk/NRK-Live/ContentOfURL?args=Y2VyZWFsMQoxCnR1cGxlCjAKcjAK&kwargs=Y2VyZWFsMQoxCmRpY3QKMgpzMTcxCmh0dHBzOi8vbnJrMnVzLWYuYWthbWFpaGQubmV0L2kvbnJrMnVzXzBAMTA3MjMxL2NyeXB0LWIua2V5P3NkPTEwJnJlYmFzZT1vbiZlPTEmaWQ9QWdCWkM2WXN3ZFN5eDFydkRWUmt3RXlmTVA1MExPWTRkWTJtTzBOWHRKSUg0eUw2JTJmbW9rdWRpRm44bUU2cmwzYTIlMmZpMTFpTkpQNE90USUzZCUzZHMzCnVybHMzMQpfYWxpZF89OWtTczEvbVZSSm5vMWNtaDQ2WGNZQT09czcKY29va2llc3IwCg__

2014-09-08 20:03:19,924 (10d0) : DEBUG (runtime:49) - Received packed state data (80 bytes)

2014-09-08 20:03:19,926 (10d0) : DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.system/serviceFunction/url/com.plexapp.plugins.nrk/NRK-Live/ContentOfURL

2014-09-08 20:03:19,927 (10d0) : DEBUG (runtime:49) - Received packed state data (80 bytes)

2014-09-08 20:03:19,930 (10d0) : DEBUG (networking:172) - Requesting ' https://nrk2us-f.akamaihd.net/i/nrk2us_0@107231/crypt-b.key?sd=10&rebase=on&e=1&id=AgBZC6YswdSyx1rvDVRkwEyfMP50LOY4dY2mO0NXtJIH4yL6%2fmokudiFn8mE6rl3a2%2fi11iNJP4OtQ%3d%3d '

2014-09-08 20:03:20,127 (10d0) : DEBUG (runtime:106) - Sending packed state data (99 bytes)

2014-09-08 20:03:20,128 (10d0) : DEBUG (runtime:918) - Response: [200] str, 16 bytes

2014-09-08 20:03:20,535 (9a8) : DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.system/serviceFunction/url/com.plexapp.plugins.nrk/NRK-Live/ContentOfURL?args=Y2VyZWFsMQoxCnR1cGxlCjAKcjAK&kwargs=Y2VyZWFsMQoxCmRpY3QKMgpzMTg4Cmh0dHA6Ly9ucmsydXMtZi5ha2FtYWloZC5uZXQvaS9ucmsydXNfMEAxMDcyMzEvc2VnbWVudDE0MTAxOTg5NV8zNTI4X2F2LWIudHM%40c2Q9MTAmcmViYXNlPW9uJmU9MSZpZD1BZ0JaQzZZc3dkU3l4MXJ2RFZSa3dFeWZNUDUwTE9ZNGRZMm1PME5YdEpJSDR5TDYlMmZtb2t1ZGlGbjhtRTZybDNhMiUyZmkxMWlOSlA0T3RRJTNkJTNkczMKdXJsczMxCl9hbGlkXz05a1NzMS9tVlJKbm8xY21oNDZYY1lBPT1zNwpjb29raWVzcjAK

2014-09-08 20:03:20,539 (9a8) : DEBUG (runtime:49) - Received packed state data (80 bytes)

2014-09-08 20:03:20,540 (9a8) : DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.system/serviceFunction/url/com.plexapp.plugins.nrk/NRK-Live/ContentOfURL

2014-09-08 20:03:20,542 (9a8) : DEBUG (runtime:49) - Received packed state data (80 bytes)

2014-09-08 20:03:20,628 (9a8) : DEBUG (networking:172) - Requesting ' http://nrk2us-f.akamaihd.net/i/nrk2us_0@107231/segment141019895_3528_av-b.ts?sd=10&rebase=on&e=1&id=AgBZC6YswdSyx1rvDVRkwEyfMP50LOY4dY2mO0NXtJIH4yL6%2fmokudiFn8mE6rl3a2%2fi11iNJP4OtQ%3d%3d '

So I guess the limitation is the bandwidth? We are blessed with a 2 Mbps ADSL line. Could this be a typical behaviour (eror, error, play, error, ...) for low internet speeds for streaming? Youtube tends to go OK, but NRK is sending HD or ?

— Reply to this email directly or view it on GitHub https://github.com/eithe/NRKTV.bundle/issues/2#issuecomment-54865122.

Erling Brandvik +4790851110

burnbay avatar Sep 08 '14 20:09 burnbay

Checked out NRK's setup page: Maks bitrate på programmer i opptak

Bitraten er kvaliteten på videoen. Desto høyere tall du valger, desto bedre kvalitet. Det er ikke gitt at din dings er i stand til å vise frem den høyeste kvaliteten. Og dersom du har en treg eller ustabil forbindelse må du klare deg med lavere kvalitet. Du kan ikke stille på kvaliteten på direktesendinger.

As you can see live quality cannot be changed. I guess you will not get an image on lower resolutions. Anyhow, give the code change a try.

Erling

On Mon, Sep 8, 2014 at 10:40 PM, Erling Brandvik [email protected] wrote:

I think you're onto something. The live streams are all over SSL, and some clients don't support that (Roku among others). In order to fix that, we need to patch the playlist (m3u8). First of all we read the original m3u8 and pick the highest bitrate (lazy, I know). I guess we can add a bitrate setting for the plugin so that the proper stream gets picked. The original playlist looks like this:

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=164000,RESOLUTION=320x180,CODECS="avc1.66.30, mp4a.40.2"

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_164_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=164000,RESOLUTION=320x180,CODECS="avc1.66.30, mp4a.40.2"

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_164_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=264000,RESOLUTION=480x270,CODECS="avc1.66.30, mp4a.40.2"

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_264_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=264000,RESOLUTION=480x270,CODECS="avc1.66.30, mp4a.40.2"

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_264_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=464000,RESOLUTION=640x360,CODECS="avc1.66.30, mp4a.40.2"

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_464_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=464000,RESOLUTION=640x360,CODECS="avc1.66.30, mp4a.40.2"

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_464_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=928000,RESOLUTION=640x360,CODECS="avc1.77.30, mp4a.40.2"

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_928_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=928000,RESOLUTION=640x360,CODECS="avc1.77.30, mp4a.40.2"

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_928_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1428000,RESOLUTION=960x540,CODECS="avc1.77.30, mp4a.40.2"

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_1428_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1428000,RESOLUTION=960x540,CODECS="avc1.77.30, mp4a.40.2"

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_1428_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1928000,RESOLUTION=960x540

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_1928_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1928000,RESOLUTION=960x540

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_1928_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2728000,RESOLUTION=1280x720

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_2728_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2728000,RESOLUTION=1280x720

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_2728_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3528000,RESOLUTION=1280x720

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_3528_av-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3528000,RESOLUTION=1280x720 https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_3528_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_3528_av-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=64000,CODECS="mp4a.40.2"

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_164_a-p.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=64000,CODECS="mp4a.40.2"

https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/index_164_a-b.m3u8?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d

All links are also HTTPS and new playlists. The picked playlist contains the actual video segments and encryption information:

#EXT-X-KEY:METHOD=AES-128,URI="https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/crypt-b.key?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d https://nrk3us-f.akamaihd.net/i/nrk3us_0@107233/crypt-b.key?sd=10&rebase=on&e=1&id=AgBU6shyUacmRlMRDlRSNeDCVGjeq92xHK2NsavBxLQERxgNLu23qNbaJUQEdt8UlnOWeSzeNcZ90A%3d%3d",IV=0xb3aa051776ddb03d2b2457d6960a2532

I guess that line breaks the web client.

If you go to line 140 in ServiceCode.pys located in C:\Users\AppData\Local\Plex Media Server\Plug-ins\NRKTV.bundle\Contents\Services\URL\NRK-Live (windows) and change the line from:

sorted_streams = sorted(streams, key = lambda stream: stream["bitrate"], reverse = True)

to

sorted_streams = sorted(streams, key = lambda stream: stream["bitrate"], reverse = False)

you should get the lowest bitrate. Give it try and let me know how it goes :)

Erling

On Mon, Sep 8, 2014 at 8:27 PM, thesatman [email protected] wrote:

OK, In other words, Forget about NRK in the web client. But since you mentioned that it works on your Roku3 I decided to give it another go. I tested the live channels and got always the same error "Video unavailable, unable to play, etc ...". Until suddenly a live feed came through. Just for only a few seconds, then buffering, then error.

In the com.plexapp.system log I see that the bits and pieces (video fragments) are loaded :

2014-09-08 20:03:19,920 (10d0) : DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.system/serviceFunction/url/com.plexapp.plugins.nrk/NRK-Live/ContentOfURL?args=Y2VyZWFsMQoxCnR1cGxlCjAKcjAK&kwargs=Y2VyZWFsMQoxCmRpY3QKMgpzMTcxCmh0dHBzOi8vbnJrMnVzLWYuYWthbWFpaGQubmV0L2kvbnJrMnVzXzBAMTA3MjMxL2NyeXB0LWIua2V5P3NkPTEwJnJlYmFzZT1vbiZlPTEmaWQ9QWdCWkM2WXN3ZFN5eDFydkRWUmt3RXlmTVA1MExPWTRkWTJtTzBOWHRKSUg0eUw2JTJmbW9rdWRpRm44bUU2cmwzYTIlMmZpMTFpTkpQNE90USUzZCUzZHMzCnVybHMzMQpfYWxpZF89OWtTczEvbVZSSm5vMWNtaDQ2WGNZQT09czcKY29va2llc3IwCg__

2014-09-08 20:03:19,924 (10d0) : DEBUG (runtime:49) - Received packed state data (80 bytes)

2014-09-08 20:03:19,926 (10d0) : DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.system/serviceFunction/url/com.plexapp.plugins.nrk/NRK-Live/ContentOfURL

2014-09-08 20:03:19,927 (10d0) : DEBUG (runtime:49) - Received packed state data (80 bytes)

2014-09-08 20:03:19,930 (10d0) : DEBUG (networking:172) - Requesting ' https://nrk2us-f.akamaihd.net/i/nrk2us_0@107231/crypt-b.key?sd=10&rebase=on&e=1&id=AgBZC6YswdSyx1rvDVRkwEyfMP50LOY4dY2mO0NXtJIH4yL6%2fmokudiFn8mE6rl3a2%2fi11iNJP4OtQ%3d%3d '

2014-09-08 20:03:20,127 (10d0) : DEBUG (runtime:106) - Sending packed state data (99 bytes)

2014-09-08 20:03:20,128 (10d0) : DEBUG (runtime:918) - Response: [200] str, 16 bytes

2014-09-08 20:03:20,535 (9a8) : DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.system/serviceFunction/url/com.plexapp.plugins.nrk/NRK-Live/ContentOfURL?args=Y2VyZWFsMQoxCnR1cGxlCjAKcjAK&kwargs=Y2VyZWFsMQoxCmRpY3QKMgpzMTg4Cmh0dHA6Ly9ucmsydXMtZi5ha2FtYWloZC5uZXQvaS9ucmsydXNfMEAxMDcyMzEvc2VnbWVudDE0MTAxOTg5NV8zNTI4X2F2LWIudHM%40c2Q9MTAmcmViYXNlPW9uJmU9MSZpZD1BZ0JaQzZZc3dkU3l4MXJ2RFZSa3dFeWZNUDUwTE9ZNGRZMm1PME5YdEpJSDR5TDYlMmZtb2t1ZGlGbjhtRTZybDNhMiUyZmkxMWlOSlA0T3RRJTNkJTNkczMKdXJsczMxCl9hbGlkXz05a1NzMS9tVlJKbm8xY21oNDZYY1lBPT1zNwpjb29raWVzcjAK

2014-09-08 20:03:20,539 (9a8) : DEBUG (runtime:49) - Received packed state data (80 bytes)

2014-09-08 20:03:20,540 (9a8) : DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.system/serviceFunction/url/com.plexapp.plugins.nrk/NRK-Live/ContentOfURL

2014-09-08 20:03:20,542 (9a8) : DEBUG (runtime:49) - Received packed state data (80 bytes)

2014-09-08 20:03:20,628 (9a8) : DEBUG (networking:172) - Requesting ' http://nrk2us-f.akamaihd.net/i/nrk2us_0@107231/segment141019895_3528_av-b.ts?sd=10&rebase=on&e=1&id=AgBZC6YswdSyx1rvDVRkwEyfMP50LOY4dY2mO0NXtJIH4yL6%2fmokudiFn8mE6rl3a2%2fi11iNJP4OtQ%3d%3d '

So I guess the limitation is the bandwidth? We are blessed with a 2 Mbps ADSL line. Could this be a typical behaviour (eror, error, play, error, ...) for low internet speeds for streaming? Youtube tends to go OK, but NRK is sending HD or ?

— Reply to this email directly or view it on GitHub https://github.com/eithe/NRKTV.bundle/issues/2#issuecomment-54865122.

Erling Brandvik +4790851110

Erling Brandvik +4790851110

burnbay avatar Sep 08 '14 20:09 burnbay

 

Changed the line from:
sorted_streams = sorted(streams, key = lambda stream: stream["bitrate"],
reverse = True)
to
sorted_streams = sorted(streams, key = lambda stream: stream["bitrate"],
reverse = *False*)
 

Got an error message as soon as I clicked on the "Live TV" icon (not responding/unavailable something). The same on my Roku. It looks like NRK is testing the connecting client in the hand shake?

thesatman avatar Sep 09 '14 07:09 thesatman

Just to be precise, you changed to False, not False, right?

On Tue, Sep 9, 2014 at 9:42 AM, thesatman [email protected] wrote:

Changed the line from: sorted_streams = sorted(streams, key = lambda stream: stream["bitrate"], reverse = True) to sorted_streams = sorted(streams, key = lambda stream: stream["bitrate"], reverse = False)

Got an error message as soon as I clicked on the "Live TV" icon (not responding/unavailable something). The same on my Roku. It looks like NRK is testing the connecting client in the hand shake?

— Reply to this email directly or view it on GitHub https://github.com/eithe/NRKTV.bundle/issues/2#issuecomment-54935145.

Erling Brandvik +4790851110

burnbay avatar Sep 09 '14 07:09 burnbay

Yes : reverse = False  

This channel is not responding.

In other words, when using False I am not even getting past the gates. With True the next screen are the 3 NRK logos (1,2+3). With False I get the error

thesatman avatar Sep 09 '14 08:09 thesatman

Any updates on this? :)

Allram avatar May 20 '15 05:05 Allram

Sorry, haven't had a chance to follow up this one.

On Wed, May 20, 2015 at 7:47 AM Allram [email protected] wrote:

Any updates on this? :)

— Reply to this email directly or view it on GitHub https://github.com/eithe/NRKTV.bundle/issues/2#issuecomment-103768514.

burnbay avatar May 20 '15 12:05 burnbay

@Allram : I can use it from my Roku Streaming stick, but can not play the videos from my PCs browser Chrome, nor can I play them from the Android Plex app.

thesatman avatar May 20 '15 15:05 thesatman