禁用HTML5视频下载? [英] Disable HTML5 video download?

查看:347
本文介绍了禁用HTML5视频下载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何禁用HTML5视频下载?我不明白,无论如何,这个问题并没有没有令人满意的答案

How can you disable downloading a video in HTML5? I Do not understand this and anyway the question doesn't have a satisfactory answer

推荐答案

我不太确定您的问题,但据我了解,您想阻止人们下载html5视频.为此,您可以使用方法,或矿: 制作2个cshtml页面:page和ogvpage(您已将问题标记为asp.net).将此代码插入页面:

Im not really Sure about your question but from what I understand, you want to stop people from downloading your html5 video. To do so you can Either use this method or mine: make 2 cshtml pages: page and ogvpage (you have tagged your question asp.net). insert this code in page:

var request = UrlData[0];
if(Request.Cookies["allow"] != null){
Response.Redirect(Href("VIDEO PATH", request + ".mp4"));
}

以及ogvpage中的此内容:

and this in ogvpage:

    var request = UrlData[0];
if(Request.Cookies["allow"] != null){
Response.Redirect(Href("VIDEO PATH", request + ".ogv"));
}

第1页将提供mp4视频,第2页将提供ogv.打开您想要播放视频的页面,并用以下内容替换您的视频元素:

page 1 will serve the mp4 video and 2 will serve ogv. open the page you want video on and replace your video element with this:

    <video>
    <source src="/page/video name without extention" type="video/mp4"/>
    <source src="/ogvpage/video name without extention" type="video/ogv>
    </video>

最后将其放在页面顶部:

and finally put this at the top of your page:

    if(Request.Cookies["allow"] == null){
    HttpCookie myCookie = new HttpCookie("allow");
    myCookie.Value = "true";
    myCookie.Expires = DateTime.Now.AddSeconds(5);
    Response.Cookies.Add(myCookie);
}

这篇关于禁用HTML5视频下载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆