Preventing downloading file from a webpage - html

I have a webpage with an audio player - normally the code would look like this
<audio controls="controls" preload="auto">
<source src="http://the_full_path/file_name.mp3" type="audio/mpeg" />
Your browser does not support the audio element.
</audio>
I want people to be able to listen to the file using the player without being able to download the file its playing. These are the first steps I took:
was adding controlsList="nodownload" to the player
disabling right click oncontextmenu="return false"
The problem: from any browser going to menu 'view-> page source' or clicking F12/Cmd+u will show the code thus the link will be reviled.
How can I achieve my desired outcome?

'and obviously there is a way to do it'
No there's not !
#zero298 answer is perfectly right(any resaerch you will do will said the same and you see your question is commonly asked for years with same answer.
All stuff you can do can easily be override because in order to use a file client side the file is download on client(cache) in order to be use by browser in local place.
Look to how WWW work and you'll understand better i think:
web server send(upload) HTML and others files related to client who get it(download) for use.
That's root of a network and can't be otherwise. If you need anything to be shared on a network you've to send it. So you can see/use(an get) a file who is not shared nor block a file once it is send.

Related

My video is not playing in both Brave browser nor Firefox

I am new to HTML and CSS (So that may be the issue). I entered the following code into my html doc:
<video controls width="700">
<source src="video/PristineCustomCleansVideo.mp4" type="video/mp4">
</video>
The video I want to play is inside a folder called video. The index.html and the video folder are nested inside a folder together.
The video shows up on the site I'm making as a gray rectangle with controls (in a Brave browser). When I press play nothing happens. I also tried opening my page in Firefox and within the gray rectangle it says "No video with supported format and MIME type found."
I looked up this question and have found so many confusing suggestions. Whatever you recommend, please do it as if I know very little about computers (I thought I knew a good amount until reading some of the responses and can't follow what I should do. lol)
Another issue I am considering is if I have to do a lot of work to get the video to play, will others that I send my website URL to have issues as well? This is for a class project. I have to put everything on the school's server and share the URL with the teacher.
If your index page and the video are located in exactly the same place you do not need the video folder in the path to your file. The following should work.
source src="PristineCustomCleansVideo.mp4" type="video/mp4"

Play audio via HTML audio tag

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.

Is it possible to get a direct audio file link from Soundcloud without JS

I've seen many posts about using JS to embed SoundCloud tracks with API links, but I'm wondering if there is any possible way to use only the <audio> and a SoundCloud file link in HTML?
The reason I need this is because I'm using Google Sheets as a widget for my website to display a list of audio files from different sources and using other sites and getting the mp3 link and throwing it in the list for the template works well but I can't do that with SoundCloud.
Preview of widget here
I know this is the URL I need:
http://api.soundcloud.com/tracks/TRACKID/stream?client_id=CLIENTID
I've tried inspecting the web page for this information, and it's not provided. I can only get the track ID.
My google sheet's template is connected to an app called awesome-table so I can put down a long list of data without needing to manually write the HTML each time so I need to make it a uniform process.
Each cell is referred to as {{URL}} in the following example
<audio controls> <source src="{{URL}}" type="audio/mpeg"> </audio>
The additional details, such as the third-party applications, are just to explain why I'm doing it this way. The question is simply how to get the right data of a Soundcloud track in a way I can directly apply <audio controls> <source src="(soundcloud track here)" type="audio/mpeg"> </audio>
Currently, the only way to do this is if the author has enabled RSS feed for the track and by using that RSS URL in the audio source.
http://feeds.soundcloud.com/stream/example.mp3
sorry if I am kind of late, but here is the correct answer:
Go copy the song URL (not the search result, be careful!)
Now, if you have VLC Media Player downloaded, open the app.
Press CTRL+N and paste it into the box.
Hit enter.
Your song will now load.
Rightclick the song name (be sure you are in playlist view in VLC) and click information (i).
On the bottom there should be a box with the text: File location.
Rightclick the box, click select all, and CTRL+C.
Now, this is your direct mp3 link.
This is mine.
https://cf-media.sndcdn.com/gesLueRDE5tg.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vZ2VzTHVlUkRFNXRnLjEyOC5tcDMiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2MjIzMDY2Mzh9fX1dfQ__&Signature=L3tgjRJ2nnUP-9qOUBuSi9cJMQL-4aaLniOegTn2z~jnIfTrfr8oJ~JMzjiOLZHCe-sVbIaSiWt3hDEOhlf1YVLj71XF~qxV~l9LpMVtIf-V0ajRkVSBxtL8da1CVEzz4GV9~8K7twCjQhHpInHJp6tCGXU7xKb3IQ2MGVzUYX1yVhI0iBtv30ww6oDCW9MKX2qgn3dFBZ~Aw4dbLu0ba4ZnFdnto8bHZVBqqq0kY9Z5CaTmm1ikvssu37XkiFPH8b8nPI6pBfS7XvAH2M3R~pKLXIGSphlfG11VZVpXxArCcDni~WPUoQpy3S5zba6R5-KkOdM5O2FN5feJouOhAA__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ
DONT KNOW ABOUT THE LINK VALIDITY LENGHT YET!!!
Viktor

Load a video from an external resource in my web hosting

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.

getting audio to work on different browsers from a server

I have used HTML 5 audio tags like the following
<audio controls="control_2">
<source src="D:\HND_grrrrr\Year_2\RoyWebsite\Sounds\WAV\home_page_readout.wav" type="audio/wav"/>
<source src="D:\HND_grrrrr\Year_2\RoyWebsite\Sounds\MP3\home_page_readout.mp3" type="audio/mp3"/>
<source src="D:\HND_grrrrr\Year_2\RoyWebsite\Sounds\ogg\home_page_readout.ogg" type="audio/ogg"/>
</audio>
Now when i load the page when it is not uploaded to a server it manages to work on chrome and IE, however on other browsers the player appears, but there appears to be no file as nothing happens when i press play.
Now when i put the page to the server (I am using USB webserver V8.2) i get nothing no matter what browser the players dont even show. I have tried changing the links to relative and nothing and ive checked that all my files are there and they are. They work when I click on the actual file on the server so i dunno.
Any help would be appreciated thanks :)
To solve the second half of your question, and potentially the first, use relative paths to load the audio files. So if your web server loads the file from /var/www/website/index.php, places the files in a closer path, ie /var/www/website/sounds, and then load the files from ./sounds/FILE_NAME.EXTENSION