0

I was building a site for presenting video courses and text explanations. My Lesson model's show page include jwplayer. Also, one of the lesson's attributes --media_file, -- contains a path to an actual video file for the current lesson.

First part of my question

UPDATE: This part resolved.

For test purposes, I placed a video file under Project/public. And in @lesson.media_file I wrote just a file name, video.webm. But the player can't find the file, player says: Error loading media: File could not be played, and the logs show that video location is presumed to be /courses/2/lessons/video.webm (it is just a route, not a file system path), although it is in Project/public/.

So, how should I be giving a location string in @lesson.media_file so jwplayer is able to find the actual video file?

Second part of my question

In above part of my test, when I put the video under /public, I just wanted to test the video embedding in Rails. But for real application, I'd like to restrict video preview, so video should be accessible only by visiting lessons show route, and video files shouldn't be publicly accessible by themselves, unlike a resource under /public.

What would be your suggestions related to protecting video files?

Thank you very much!

B.I.
  • 706
  • 3
  • 9
  • 19
  • OK, I got an answer for the first part. I placed my video.webm file under _project/public/videos/_. And as path I entered _/videos/video.webm_. Thanks to this answer: http://stackoverflow.com/a/8857540/999973 But still, I would appreciate an answer to the second part. – B.I. Oct 16 '13 at 11:53
  • I found couple of posts for the second part, protecting video: http://stackoverflow.com/questions/4582433/prevent-video-downloading?rq=1 – B.I. Oct 16 '13 at 18:50

0 Answers0