Domanda

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

È stato utile?

Soluzione

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"));
}

and this in ogvpage:

    var request = UrlData[0];
if(Request.Cookies["allow"] != null){
Response.Redirect(Href("VIDEO PATH", request + ".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);
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top