truedread / netflix-1080p

Chrome extension to play Netflix in 1080p and 5.1
MIT License
2.75k stars 303 forks source link

Errors when embedded in an iframe #53

Closed gurupras closed 5 years ago

gurupras commented 5 years ago

I run a website that enables people to watch together videos from content providers like Netflix/Amazon/YouTube/etc. We do this by using a Chrome extension to embed these websites within an iframe and then set up listeners for play, pause and seek.

Recently, I had a user report that our extension does not play along nicely with yours. After looking into it for a while, I've realized that the issue is not to do with conflicts between extensions, but the fact that this extension fails when Netflix is embedded in an iframe.

At this point, the only anomaly I've found is that the cadmium-playercore version that Netflix is serving is different from the one being injected in via this extension.

Request URL: https://assets.nflxext.com/en_us/ffe/player/html/cadmium-playercore-6.0012.829.011.js
Request Method: GET
Status Code: 307 Internal Redirect
Location: chrome-extension://cankofcoohmbhfpcemhmaaeennfbnmgp/cadmium-playercore-6.0011.853.011-1080p.js
Non-Authoritative-Reason: WebRequest API

Eventually, when you try to play a video, it results in an error with code M7111-1003.

Is there any reason you can think of as to why this extension would begin to fail when embedded in an iframe? If this is an insurmountable technical limitation, could I make a request to restrict the extension to only work only in cases where Netflix is the top frame (window.top === window)? I can certainly help make a PR for this if needed.

To reproduce this error, I've set up a pen with an embedded Netflix. Please note that you will need an extension to modify the x-frame-options header when attempting to reproduce this.

ItsNickBarry commented 5 years ago

Try running this fork with your site: https://github.com/ItsNickBarry/netflix-1080p

I can't account for the Netflix error code, but this should inject the modified cadmium-playercore into the iframe. I'll submit a pull request if it works.

gurupras commented 5 years ago

Yup. Seems to work fine. Ah, I see what's happening. I was thinking all_frames defaults to true which is why it was not included in the manifest. Turns out the background script was removing cadmium player and the content-script was not including one since it was iframed.

ItsNickBarry commented 5 years ago

I've submitted a pull request; however, this project has been mostly inactive since Netflix broke most of its functionality. You might want to direct your users towards the fork, or publish your own version.

I've submitted a pull request to the Firefix version as well.

truedread commented 5 years ago

merged! thanks @ItsNickBarry