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

Support for youtube-nocookie.com #272

Closed
Betree opened this issue Nov 9, 2017 · 10 comments
Closed

Support for youtube-nocookie.com #272

Betree opened this issue Nov 9, 2017 · 10 comments

Comments

@Betree
Copy link

Betree commented Nov 9, 2017

Youtube provides a service to integrate a video without leaving a cookie if the user does not click on play. It simply use the form youtube-nocookie.com/embed/youtube_id.

I'd love to be able to do something like:

<ReactPlayer url="https://www.youtube.com/watch?v=dQw4w9WgXcQ" config={{
    youtube: {
        noCookie: true
    }
}}/>

That would convert https://www.youtube.com/watch?v=dQw4w9WgXcQ to https://youtube-nocookie.com/embed/dQw4w9WgXcQ automatically.

However if you think this should be handled by a parent component, I'd like to be at least able to provide a youtube-nocookie url to ReactPlayer (which would be a 14 characters change in the code 😉).

Tell me which one you prefer so I can work on a PR.

Ps: You can check that this is legitimately owned by Google here: https://www.whois.com/whois/youtube-nocookie.com

@cookpete
Copy link
Owner

cookpete commented Nov 9, 2017

ReactPlayer uses the YouTube iFrame API to play videos. To support this, the API needs to support it. I can't find any documentation about a nocookie mode in the docs or the custom player params, so I'm not sure this can be done yet.

Adding to the youtube URL pattern wouldn't do much, because it's only used for the canPlay method and to parse the 11 character video ID.

@Betree
Copy link
Author

Betree commented Nov 9, 2017

Thanks for the response, it's indeed undocumented. But you can actually activate the option from Youtube's share menu, so I guess it's not deprecated:

Screenshot Youtube

What about implementing it as a new provider that would put the URL directly in a IFrame ?

<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>

@cookpete
Copy link
Owner

Yeah I don't think it's deprecated, but it's just not part of the iFrame API.

Unfortunately, it looks like you lose all events and interactions with the player in nocookie mode:

The only way ReactPlayer will be able to support this is if they add nocookie support to the iFrame API, to retain the existing methods and event hooks. Otherwise there is no point using ReactPlayer and you might as well just render <iframe src="https://www.youtube-nocookie.com/..." /> in React.

@Betree
Copy link
Author

Betree commented Nov 13, 2017

I definitely rely on ReactPlayer events and hooks so the iframe will not work for me.
Thanks for taking the time to check this. I'll follow the issues you have linked to see if there are any changes in the future.

@AlexandreKilian
Copy link

@Betree @cookpete there is actually a way, it's just not documented… I can make a pull-request right away :)

cookpete added a commit that referenced this issue Jan 24, 2019
Closes #557
Allows the use of the `host` option, which fixes #272
@cookpete
Copy link
Owner

In 1.9.0 I've added embedOptions to the youtube config that lets you pass in a custom host option:

<ReactPlayer
  url='...'
  config={{ 
    youtube: { 
      embedOptions: { 
        host: 'https://www.youtube-nocookie.com' 
      } 
    } 
  }}
/>

And override any other options in future, if you want to.

@hansmodo
Copy link

hansmodo commented Feb 7, 2019

I notice that the demo app ( https://cookpete.com/react-player/ ) doesn't include support for the nocookie host. I saw the changes to demo/App.js committed with 1.9.0. Is the demo url just not using the latest code? I'm asking because I've not been able to get the new 'embedOptions' config to work and wanted to see a working version.

@AlexandreKilian
Copy link

@hansmodo the new solution doesn't have a top level prop for the embed Option, I assume that's why there isn't an option in the demo app… But I've tested it, it works

@mayank1112
Copy link

Doesnt work for me

cookpete added a commit that referenced this issue May 23, 2020
Fixes #896
Thoroughly fixes #272
Thoroughly fixes #557
albanqoku added a commit to albanqoku/react-player that referenced this issue Feb 24, 2021
Closes cookpete/react-player#557
Allows the use of the `host` option, which fixes cookpete/react-player#272
Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
Closes cookpete/react-player#557
Allows the use of the `host` option, which fixes cookpete/react-player#272
Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
@borisrorsvort
Copy link

As mentioned in https://axbom.com/embed-youtube-videos-without-cookies/ the no-cookie mode still save a local storage to store a device id and track you none the less which, without consent, anti gdpr.

webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
Closes cookpete/react-player#557
Allows the use of the `host` option, which fixes cookpete/react-player#272
webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
philip-luther added a commit to philip-luther/react-player that referenced this issue Nov 22, 2024
Closes cookpete/react-player#557
Allows the use of the `host` option, which fixes cookpete/react-player#272
philip-luther added a commit to philip-luther/react-player that referenced this issue Nov 22, 2024
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

6 participants