How do you disable right-click on FLV Videos?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

How do you disable right-click on FLV Videos?

Post by simonmlewis »

Not sure if this is specific to PHP, but we have a database that has the Youtube embed video code.

We want to disable people from being able to right-click on the video, and showing to Download to Real Player.

This is not user specific, this is general via the web site, so ANYONE who right clicks, cannot download the vid.
We would like to hide the embed code from the HTML, but I don't see any way that is possible, except for an encryption method which I have no idea how to do anyway.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
aIexi
Forum Newbie
Posts: 12
Joined: Wed Mar 16, 2011 10:46 pm

Re: How do you disable right-click on FLV Videos?

Post by aIexi »

Couldn't you put the video inside of a DIV, and then use jquery or javascript to do some kinda of "on mouse over disable right click" type thing?
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do you disable right-click on FLV Videos?

Post by simonmlewis »

I'm sure you could, but I've no idea how you would do that, sorry.
Plus, I don't know if disabling a right click in a DIV would also disable it in the FLV, which always force themselves into the foreground.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
aIexi
Forum Newbie
Posts: 12
Joined: Wed Mar 16, 2011 10:46 pm

Re: How do you disable right-click on FLV Videos?

Post by aIexi »

You could give the DIV an ID, and then sit it's Z as -1 XD
aIexi
Forum Newbie
Posts: 12
Joined: Wed Mar 16, 2011 10:46 pm

Re: How do you disable right-click on FLV Videos?

Post by aIexi »

Or better yet, layer it...

make 2 divs. set 1 div inside the other div. Set the outer div with a transparent back ground and set it's Z as 10.

Then put the other thing in the inner div, and set it's div as -1 XD
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do you disable right-click on FLV Videos?

Post by simonmlewis »

I'm with you, so the outer div is set to the foreground. But how do you prevent what's in the DIV to be right-clicked?
Or is simply layering one over the other, going to stop the person from doing that anyway?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do you disable right-click on FLV Videos?

Post by simonmlewis »

[text] <div class='videoouterbox'>
<div class='videoinnerbox'>
<font color='#ffffff'>HELLO</font>
</div>
</div>[/text]

[text]
.videoouterbox
{
background-image: url(../images/videobkrnd.gif);
z-index:10;
}

.videoinnerbox
{
z-index:-1;
}[/text]

"HELLO" can be seen. What have I entered wrong?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do you disable right-click on FLV Videos?

Post by simonmlewis »

I've tried this with the youtube embed code in the innerdiv bit, and it doesn't force the box to expand with it. you get a big box above, and the box that's meant to contain the video, it just like 25px high, and the video is slap bang over the top of it.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do you disable right-click on FLV Videos?

Post by simonmlewis »

[text].videoouterbox
{
background-color:#eeeeee;
width:700px;
height: 390px;
position: relative;
top: 35;
z-index: 10;
}

.videoinnerbox
{
background-color:#eeeeee;
width:700px;
height: 390px;
position: relative;
top: -355;
z-index: 1;
}[/text]

This puts the grey box right over the video - perfect. But if I use a transparent image, or set the color of the background to transparent, the Video comes into the foreground, and right click to find the Video Menu again.

This is so close.... but it's like Boolean: ON or OFF !!
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Bind
Forum Contributor
Posts: 102
Joined: Wed Feb 03, 2010 1:22 am

Re: How do you disable right-click on FLV Videos?

Post by Bind »

simonmlewis wrote: We want to disable people from being able to right-click on the video
in the embedded object tag, put the following:

Code: Select all

oncontextmenu="return false" ondragstart="return false" onselectstart="return false"
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do you disable right-click on FLV Videos?

Post by simonmlewis »

Which object? In the DIV (how?), in the video (tried it in the video embed code from youtube - makes no different).

[text]<iframe title="YouTube video player" width="700" height="390" src="http://www.youtube.com/embed/ZXRnbmP_dZM" frameborder="0"
oncontextmenu="return false" ondragstart="return false" onselectstart="return false"
allowfullscreen></iframe>[/text]
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Bind
Forum Contributor
Posts: 102
Joined: Wed Feb 03, 2010 1:22 am

Re: How do you disable right-click on FLV Videos?

Post by Bind »

you need control of the html that displays the video - your type of iframe embedding just displays youtubes source code (embed page) that displays the player video.

This is the type of embedding i am talking about:

Code: Select all

<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/YUYCBfmIcHM?fs=1&hl=en_US" oncontextmenu="return false" ondragstart="return false" onselectstart="return false">
</param>
<param name="allowFullScreen" value="true">
</param>
<param name="allowscriptaccess" value="always">
</param>
<embed src="http://www.youtube.com/v/YUYCBfmIcHM?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385" oncontextmenu="return false" ondragstart="return false" onselectstart="return false"></embed></object>
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do you disable right-click on FLV Videos?

Post by simonmlewis »

I still get the RealPlayer "download video" link in the right click menu.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do you disable right-click on FLV Videos?

Post by simonmlewis »

Is the answer, that is just is NOT possible??

If I use the DIV Layer option, I have to use a background color in order to force it to display over the embedded youtube video. But the only way it will do it is with no transparency.
If I put an image in that FRONT DIV, it won't display, unless I have the background color set - with no transparency.

It's maddening.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
danwguy
Forum Contributor
Posts: 256
Joined: Wed Nov 17, 2010 1:09 pm
Location: San Diego, CA

Re: How do you disable right-click on FLV Videos?

Post by danwguy »

You can't stop Real Player from downloading video, it's in the options of Real Player itself. Real Player sees a video on a page and grabs the link. There is no way to stop it. All above options will work great for disabling access to the video, but if you have a program like Real Player it sees the source code of the video and grabs it no matter what you do.
Post Reply