In youtube, there's an option to use privacy-mode, where cookies are disabled for the guests of your site that play the video.

Here's the standard code:

<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/lEXZ2hfD3bU&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/lEXZ2hfD3bU&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>

As opposed to privacy mode, where the domain changes to www.youtube-nocookie.com, but everything else stays the same.

<object width="640" height="385"><param name="movie" value="http://www.youtube-nocookie.com/v/lEXZ2hfD3bU&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/lEXZ2hfD3bU&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>

Ideally, the site would accept either type of embed code and allow the site administrator to override them all to privacy mode or non privacy mode. I see a simple str_replace() as able to achieve this functionality. What do you think?

CommentFileSizeAuthor
#4 media_youtube-privacy-764646-4.patch10.24 KBbsevere
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

timwood’s picture

Sub. I have a need for this option on a Federal government site. Preferably it would be an option exposed on the admin/settings/media_youtube settings screen. Perhaps in the YouTube video player options section.

Thanks!

timwood’s picture

Version: 6.x-1.x-dev » 6.x-1.2

Here is the FAQ page on Youtube about the feature. I briefly tried to make the modifications to the 1.2 branch I downloaded, but the changes needed in themes/media_youtube.theme.inc were beyond my programming ability. This youtube option is a bit more complicated then, for example the HD option, because it changes the domain the embedded media is coming from (www.youtube.com vs www.youtube-nocookie.com).

WebJohn’s picture

Title: youtube privacy mode » YouTube privacy-enhanced mode
Version: 6.x-1.2 » 6.x-1.3
Component: Documentation » Code

Bumping this up since it's still an issue in 1.3. This is also more of an issue since the EU Cookie Regulations have now come in to force. Having this option as a tick-box when adding media to a piece of content would be great - or having this as a global setting that would apply to all YouTube embeds.

bsevere’s picture

Version: 6.x-1.3 » 6.x-1.x-dev
FileSize
10.24 KB

We created a patch for our production environment some time ago (pre git). It applied to version 6.x-1.3 and it worked for our purposes. I have recreated the patch for dev version.

We followed the global setting path. Our users are expected to know which videos need to be privacy-enabled and use the appropriate embed code when saving a new video. The patch allows the media_youtube module to detect the embed code settings for each video and present them accordingly.

We also had a need for the https option and that is included in this patch as well.

bsevere’s picture

Status: Active » Needs review

setting status to needs review.

RobW’s picture

Mschudders’s picture

I have also needed to add this :

'@youtube-nocookie\.com/(?:v|embed)/([^"\&\? ]+)@i',
in function emvideo_youtube_extract($video_id = '')