Stream video outside of root

I'm storing mp4 videos in a folder outside of the root, but need to stream them to a password protected webpage.  I tried this code, but it isn't seeing the files.  (I'm using an Apache webhost)

             <video width="500" height="282" controls>
              <source src="$videoPath<?php echo $video_file;?>" type="video/mp4">
              <source src="movie.ogg" type="video/ogg">
                  Your browser does not support the video tag.
            </video>

The error "No video with supported format and MIME type found" shows

When I put the video in the root and switch the path, it works fine.

Any help is greatly appreciated.

Thanks,

Steve
LVL 2
stkoontzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gheistCommented:
Alias /videos /mnt/usb
You can alias single files too
0
stkoontzAuthor Commented:
I don't know what you mean by 'alias'.  Can you tell me how that would fit with my code?

Thanks for responding to help me out.  I appreciate it.

Steve
0
Ray PaseurCommented:
You might consider using a fully-qualified URL.  If the video is not in the web root directory tree, a relative URL is probably not going to work.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

stkoontzAuthor Commented:
The URL I'm using is the URL my hosting company has me use to access files outside of the public_html folder.  It's the same URL I use in other applications to access PDF files stored outside the public folder.  Would a fully-qualified URL point to the public_html folder?

Thanks for joining in to help.

Steve
0
gheistCommented:
You must start with public_html.
In this case you can send files using PHP, but nothing else (If you do not show code noone can help)
With "Apache Webhost" usually a full control of httpd.conf is presumed.
0
stkoontzAuthor Commented:
My first post has the code I'm using to try to play the videos on the page.  

I'm manually uploading the files myself through FTP, so there's no code to show for the file upload.

It's a very basic system to give access to only a few people to watch the videos.  I just don't want the videos to be accessible unless someone has the login information.  In other words, found if someone does a Google search.

Does that help to clarify the questions?

Thanks,

Steve
0
gheistCommented:
Then you need to check the authorization and send video file in php
0
stkoontzAuthor Commented:
Can you help me with how I would do that?
0
Ray PaseurCommented:
This article can show you how to password-protect a page.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_2391-PHP-login-logout-and-easy-access-control.html

That's only part of the issue, though.  If you want to create an HTML link to a video file, your situation is conceptually the same as the publisher who wants to put his photos online, but prevent anyone from stealing the photos -- it is almost impossible to achieve that because the browser must have a copy of the resource (photo, video, PDF, whatever) in order to display it.

You might consider running the PHP script to create a temporary folder, copy the video into that folder, then generate the HTML for the web page.  You can use a garbage collection algorithm or a cron job to delete anything in the temporary folder that is older than X minutes, where X is the run-time for the video.

You might also create a password-protected PHP script that just copies the video to the stdout stream using something like fpassthru().  I have never done this, but it would not be hard to test.  If you can use the URL of the PHP script in the source tag, you should be OK.  You may have a bit of a research project on the correct http headers for video.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stkoontzAuthor Commented:
I wrote a script to copy the files into a temporary directory.  Thanks, Ray, for the suggestion.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.