Suppose I want to develop a web site with a lot of videos, since there will be a lot of videos I will need a lot of space in the server-side, how can I store a large number of videos for the website?
I mean, for playing a video I need to write in the HTML tag a relative path, like: ~/MySite/Videos/video1.mp4, but since I will have a lot of videos I thought to put all videos on external USB's with a lot of space.
how can I tell the HTML to navigate to the USB drive, how to approach this issue?
"...Let's say I want to read videos from multiple usb's then I have a problem."
You can try the file protocol (for local machine files, instead of online loading via https protocol).
The format is: file:///X:// (where drive X is your own preferred).
Example: This html could be on drive G: and yet be loading a video file from drive E:
<!DOCTYPE html>
<html>
<body>
<video width="800" controls>
<source src="file:///E://VC1_files/trailer_Watchmen_HBO_01.mp4" type="video/mp4">
</video>
</body>
</html>
Related
My hosting doesn't allow me to upload mp3 or any audio files, so is there any way I can link audio in some other way? I know we can embed soundcloud and stuff but just wondering if there was any other alternative.
I’ve found this very useful guide that covers some alternatives:
Linking to a sound file using a href allows a browser to open and play
an audio file if the viewer of your web page has properly configured
their Internet browser. You can also use the tag or the newer
tag to insert a sound file directly into a web page.
<a href> tag
<a href="https://www.computerhope.com/jargon/m/example.mp3">Play sound
file</a>
<audio> tag
The tag can create a media player as part of the web page. It allows the visitor to play, stop, pause, or download an audio file. The element is compatible with all modern web browsers.
<audio controls>
<source src="https://www.computerhope.com/jargon/m/example.mp3" />
</audio>
<embed> tag
An older method of including audio files is to use the tag. While this method certainly works, it is less efficient than those which were mentioned above. As such, we recommend using one of the solutions demonstrated above.
<embed src="https://www.computerhope.com/jargon/m/example.mp3">
I figured the best way to do it without uploading your audio/music, BASE64 ENCODING!!
Very easy, kinda messy and supposed to be used for images I guess but works fine with audios and should work with videos as well (haven't tried videos)
Here a base64 encoder: https://omatsuri.app/b64-encoding
WARNING THOUGH! IT MIGHT GET LAGGY & MESSY
I have HTML document that is supposed to play the audio file via tag.
My main problem is what kinda URL am I supposed to feed this tag in order for it to play.
For example, I have the file in folder completely different from HTML file, even stored on external SSD, and I have path to it, how do I play this file?
My code looks something like this:
<audio controls source="PathToFile"></audio>
It isn't possible to open arbitrary files from a user's local machine, as this has bad implications for security.
If you want to load local files, the user has to either select the directory/files with a <input type="file"> element, or they have to drag/drop the directory/files so that you can get a reference that way.
I guess you should have something likes this:
<audio controls autoplay>
<source src="/sounds/The Wolven Storm (Priscilla's
song).mp3"
type="audio/mpeg"/>
</audio>
If your website is hosted at some place that you have access to, your website is hosted on a local machine, and your SSD is plugged in to the same machine as your website, you could use absolute file paths inside of the quotes to achieve this.
for example:
<audio controls src="C:/Absolute/File/Path/To/Audio.mp3"></audio>
I hope this helped in answering your question.
I have a video tag with a video linked to it and it runs fine, like this
<div class="VideoFrame">
<video id="Video" src="Videos/AnonomousVideo.mov" controls width="640" height="480"></video>
</div>
is this safe, to just have a folder with a video file in it linked to a video tag. this doesnt give any problems performance wise
To answer your question, yes it is safe to have a video uploaded on your server.
However
This may cause a lot of bandwidth usage.
This could slow down your site if multiple people are downloading it at the same time.
Alternatives
Why not just use YouTube or Vimeo?
I have a short video that I want to upload and use in the following code:
<video>
<source src="video_url.mp4">
</video>
It's very simple but my problem is: I have no own file server. That's why I have to find a file-hosting provider where I can upload my video and use it from there.
But all they give me is just a download link for the video which is not what I need. What I need is a video-URL that directly plays the video.
For example like this one: http://clips.vorwaerts-gmbh.de/VfE_html5.mp4
I have actually found a site that does what I need. This is the site: https://pomf.se
But unfortunately, that site is not available anymore.
Can anyone help me? How or where can I upload my video to get the required link-format? (I have the same problem with audio files)
Could you use YouTube? You can create unlisted videos so they don't show up to the general public (they aren't public though). Other options could be Dropbox or S3 for inexpensive ways to host the videos yourself. Fact is, its storage space.. and that isn't free.
I have a simple web page written in HTML for testing video streaming.
<video controls name="media">
<source src="external_url.mp4" type="video/mp4">
</video>
That's work in local, but when I upload the page on my free web hosting, the page doesn't load any video. Is there a workaround? Maybe using an embedded player?
update
I've discovered that's a problem related to video. Unfortunately I cannot link it because it's for a private presentation, but I've tried with other videos and that works well. Any idea why my video doesn't play?
Please check that the URL is intact.
Check if there might be some file discrepancies. The control currently supports mp4, ogg, and webm as seen here.
Use the canPlayType() method to test the site AFTER the upload - just to be sure we're covered on that front. See here for the DOM reference.
You can fiddle around here if you don't want to have to upload the site first before live-testing it.
Hope that helps.
How do you upload the video? If FTP, text transfer mode may have ruined the file. The hosting (especially, a free one) can impose a limit on the file size (uploaded or served) too. Or even on content types (e.g. narod.ru didn't allow to read files directly, serving a "download page" on an attempt instead).
Try to download the video file directly and compare it with the reference one.