I am using ASP.NET MVC 4 for a web site. The site manages online events for our group and gives registered users access to online materials, archives of web events and instructional videos. I have built a system for uploading and managing the videos, now I need to build the Controller Actions to send the video files to the web page. We are using VideoJS as the viewer and I am pretty happy with that right now. We need to maintain security on the files so just having the files sit at a location on the web server doesn't seem to work for us.
My main question is what is a good method for returning the files to the viewer? I am used to using ActionResult and JSONResult classes, but they don't quite seem right for video files. The files can be VERY large, sometimes up to a GB or more. I see the MVC FileResult class, the FileStreamResult class and the FileContentResult class. Which one should I use and what other considerations should I be thinking about when I build this?
I appreciate your help.
Doug
You most certainly should not send the entire video as a response to the viewer, as they would be waiting around for a good while for it to download. You need to stream it to them. I imagine you'd need some kind of byte stream being returned from the controller.
There's a reason that places like YouTube offer their videos via flash - because the quality and rate can be controlled easily, and it offers a certain amount of copy protection (though it is not foolproof). I just did a quick Google search, and found this:
http://www.longtailvideo.com/jw-player/download/
Might be useful, but I can't vouch for it personally!
Apparently, Razor offers it's own handling of video files, that you might find useful:
http://www.asp.net/web-pages/tutorials/files,-images,-and-media/10-working-with-video
Also, HTML5 supports video streaming (which I'm sure you knew as VideoJS uses it):
http://www.w3schools.com/html/html5_video.asp
Related
I've been asked to create an education ebook which contains 200 videos for a total size of 25 Go (!).
Although it is my first ebook creation, I can't imagine to embed so many videos in the epub file, and so, I plan to only use external videos.
Since the making of these videos requested a lot of work (and personnal funds), the teacher want to secure the videos and avoid the videos to be stolen and made publicly visible on other sites.
How can I include external videos in an epub ebook in a safe manner ?
Thanks in advance for any tips !
Short answer: there is no way to 100% "protect" a resource embedded in an EPUB file, if the user has access to the EPUB file itself.
Long answer: unless you are also creating the reading application intended to be used for consuming those EPUB files and thus you can prevent the user from "reaching" the actual EPUB file, there is no 100% secure way of preventing a user from extracting a resource (the video, in your case) from an EPUB file.
Traditionally, to prevent "oversharing" of the EPUB file itself or "unauthorized extraction" of some assets (images, audios, videos) two main techniques are used: DRM or per-purchase watermarking. If you apply a DRM (i.e., the Adobe DRM), there are programs to remove it with just a click. The per-user watermarking route seems difficult for videos, I do not think any watermark provider has a tool to insert hidden user info inside videos embedded in EPUB files.
Another possibility consists in NOT embedding the video inside the EPUB file, and just link to it or to declare it as a "remote resource" (see http://www.idpf.org/epub/301/spec/epub-publications.html#sec-resource-locations ). But again, this does not prevent a malicious user from downloading the video from the URL you need to specify in the EPUB file.
Probably the best solution consists in showing some information (like "(c) Name_of_the_author, 2016") in a corner of the video. Again, very determined pirates might crop that text off, but at least discourage the "casual oversharers".
As with every ePub response, this depends entirely on the distribution channels they require. If they plan to distribute the ePub files directly, and the ePub files are ePub3 / HTML5 compatible, I would suggest this:
host the videos on a site that provides custom domain-level-access to the videos (like Vimeo: https://help.vimeo.com/hc/en-us/articles/224817847-Privacy-settings-overview), then have the video live in an iFrame to your site and require users to authenticate to that iFrame before the videos will play.
This will prevent people from sharing the videos by simply copying and pasting a URL, which will give you client peace of mind. But there will ALWAYS be the possibility of an authenticated user downloading/saving the video and then re-posting it in a public place. But you will always have that possibility regardless of security: because someone can always do a screen record and audio capture for any video they can see.
Best of luck,
-Alex
Here im hitting my head againt the wall.
My client provided a pdf with buttons(just like buttons,when user tap on button,it will load next page and previous page etc.).
This buttons will work only when we open it in adobe reader.
I tried the QLpreviewview,quickview but it is not working,all what i can do is just to load the pdf in the webview.
Can anyone please help me in how to load an interactive pdf in iOS.
Thanks in advance.
Have a look at PSPDFKit, it is the most advanced framework I've found for PDFs in iOS. They have an impressive list of customers as well.
It is a bit pricy though, but you have the option to get the Source Code too if you need to modify anything. Could be worth it if your client need that kind of performance and other features as well.
(I am not in any way affiliated with PSPDFKit)
The limitations are due to the capabilities (or non-capabilities) of the PDF viewer used.
Currently the leading PDF viewer on iDevices is PDFExpert by Readdle. Adobe Reader for iDevices is weaker, but can deal to some extent with form elements.
For page navigation etc. you might use links instead of button fields (as far as you can live with the capabilities of links, and not use JavaScript). Links are said to be handled properly with many PDF viewers.
You may have to require certain PDF viewers on instructional level, because you don't have control over the viewer used by the actual user. And, as you noticed, many PDF viewers are simply too dumb do deal with active elements.
Another approach would be looking at PDF-to-HTML5 converters, and serve HTML5 from a server.
I'm building a Rails app that has videos that users will see on the app and they will pay for it. So I need to ensure that no one can download the video. How can I protect, for example, that someone go to the source code the page and find the link and download it?
You can't really do this in standard Rails techniques. If you are serving the file yourself: Dirty Web Video Secret: If You Can See It, You Can Steal It
You can’t guarantee that a video can’t be copied, but you can make it harder by limiting the people with access to the video, by letting those people know that you can track how they view your videos, and by putting some reasonable technological hurdles in the way.
If you are OK using flash, then you can look at Brightcove's solution that uses "DRM" http://support.brightcove.com/en/video-cloud/docs/protecting-your-videos-drm
What do most people do?
They use an authenticated URL that expires (to prevent emailing and sharing), and trust their users won't download and share the videos. They then ignore those that do share (or file DCMA takedown requests).
I have a web application that i have developed in RoR 2.1. In the app, users have the privilege of uploading media files. Currently, only FLV videos can be streamed online since i have given FLV player browser support.I have used the gem Mime Types to identify the file fomats of the media files being uploaded.
I would like to get the feasibility and ways to implement two new requirements
How can i stream all videos being uploaded online? Should I convert these files to flv or
is there any other way of making it possible?
I want the users who upload the videos to set a privilege (count) of how many users can
stream this video on line at a given time. How can i implement this?
1) for streaming you should use a CDN, this should not be the responsibility of your rails app. Lots of options, I have enjoyed working with S3/Cloudfront. Streaming through your app will really hurt the scalability of your platform. Lets the good folks at the CDN deal with this.
2) To throttle the usage -- I would do the following. When a web user wants to watch a video give them a link you your app (vs directly to the CDN) so http://myapp/video/watch. In that method(VideosController#watch) you can count concurrent views, and if under the threshold then perform a secure redirect to the video.
If you must serve files directly from your server use send_file method (doc)
If you are looking for video playback, there a bunch of javascript/html5 video solutions: VideoJS is a pretty good one: http://videojs.com/, It should be able to handle many different types of video formats
enter link description here
Good luck
We're using a FileStreamResult to provide video data to a Silverlight MediaElement based video player:
public ActionResult Preview(Guid id) {
return new FileStreamResult(
Services.AssetStore.GetStream(id, ContentType.Preview),
"application/octet-stream");
}
Unfortunately, the Silverlight video player downloads the entire video file before it starts playing. This behavior is expected as our Preview Action does not support downloading partial content.
(side note: if the file is hosted in an IIS virtual directory we can start playback at any location in the video while it is still downloading. however for security and auditing reasons we can't provide a direct download link. so this is not an option.)
How can we improve the Controller Action to support partial HTTP content?
I assume we first have to inform the client that we support it (adding an "Accept-Ranges:bytes" header to a HEAD request), then we have to evaluate the HTTP "Range" header and stream the requested file range with a response code of 206. Will that work with ASP.NET MVC hosted on IIS6? Is there already some code available?
Also see:
http://en.wikipedia.org/wiki/List_of_HTTP_headers
http://blogs.msdn.com/anilkumargupta/archive/2009/04/29/downloadprogress-downloadprogressoffset-and-bufferprogress-of-the-mediaelement.aspx
http://benramsey.com/archives/206-partial-content-and-range-requests/
There is a project on CodePlex which gives this exact functionality.
http://mediastreamingmvc.codeplex.com/
Take a look. It was created specifically for this scenario where you want to have an action representing a request for a virtual resource and return partial content if so requested without requiring the developer to do much to support it (an Action Filter and choice of Result types.)
You have to implement this by yourself. And yes, this will work on IIS6.
If you can use IIS7 you probably better to leverage on IIS7 extensibility (example).
Then you need to reimplement throttling module :)
The idea is to calculate bitrate of your video stream and then send as much as required to client. So you need (very briefly) to read a block from your stream and send it to client and sleep for a second.
Thread.Sleep(1000) is not really a good idea for handling IIS resources so you need to do stuff in async way. IAsyncResult will be your friend.
There is much room for all kinds of optimisations.
And the last thing... I made it working as plain httphandler, not as MVC ActionResult.
If it's possible in your webiste, I'm recommending to do it as a handler.