HTML iframe audio file background - html

On a project, i have an iframe and a link targeting it. The link leads to an mp3 file. However on google chrome, and maybe other browsers, the iframe appears with a horrible black background.
Is there any way to fix this?
All solutions i have found so far talk about changing the background in the source file, but this is not possible for me as it is an mp3 file not an html file.

You have zero control over the default presentation of an audio player when you link to it in this way. In fact, it's very common that the file will just be downloaded instead of played in a browser.
If you want to control it, you need to build an HTML page that loads the audio file.

Related

How to prevent automatic download of a linked mp3 file

I am making a website using only HTML and CSS. I am trying to link to an online mp3 file (that I do not own) so that the mp3 plays in the browser. This simple code does what I want on Firefox and Safari:
<a href="https://www.allaboutbirds.org/guide/assets/sound/548271.mp3" >
However, instead of playing the mp3, Chrome automatically downloads the mp3 file to my computer. Is there some way I can alter my HTML code (not my browser preferences) to stop this from happening? Thanks.
You can't guarantee that all the browsers will have a built-in in-frame player for the audio file.
The best thing to do in this case is to embed the audio player into a page with the audio element:
<audio src="https://example.com/some-sound.mp3" controls></audio>

How to prevent users to access embedded video files in an intranet?

I need to publish an HTML page in an intranet containing the index of some video files, also located on the network. From the main page I thought of pointing, for each video, to a separate html page in which to incorporate it.
I would like to know if it is possible to prevent users from accessing video files directly by browsing the network resources. In practice, the videos should be visible only through the html pages but the relative .mp4 files should not be accessible in any other way (for example by making copy and paste via file explorer). Is it technically possible?
Finally, to prevent download from html pages I thought deactivating the right button on the embedded videos also if it's not the solution for all browsers.

Hide Properly Download Button

I have an audio playing site and I want to prevent the users from downloading the sounds
from the HTML audio element download button. So I wrote:
<audio src="sound.mp3" controls controlsList="nodownload"></audio>
It works fine but I can delete the controlsList="nodownload" from inspect element and then
the download-button appears.
Any ideas of how to deal with it?
You cannot stop a user from downloading a file if you give him access to. When the user is reading the audio file on his computer, the computer is actually downloading the file in his RAM while playing it. Nothing can prevent the user from simply storing this data in his hard-drive.
The only way to stop the user from being able to download the file is by not letting him play it.
You can use DRM-wrapped content on the web. Here is a list of the web browsers supporting DRM content.
Everything you hear or you see on your browser is downloaded from different sources. How browser can write some text or play music if its protected by server/by you? Even if browser protect all these things from you for example if theres no way to download Rihannas new song from SoundCloud, you can allways record it. Sorry, but you can do nothing about that.

Change background color in PDF viewer using either embed, object or iframe methods

I've been playing around with different methods of displaying PDFs with the goal of finding a way of changing the grey background to white.
Here is a simple example using object tags (I get the same result with embed and iframe tags):
http://jsfiddle.net/5CALy/7/
HTML
<object data='https://dl.dropboxusercontent.com/u/58922976/test.pdf#view=FitH&scrollbar=0&toolbar=0&statusbar=0&messages=0&navpanes=0'
type='application/pdf'
width='84%'
height='110px'>
<p>It appears your Web browser is not configured to display PDF files.
No worries, just <a href='https://dl.dropboxusercontent.com/u/58922976/test.pdf'>click here to download the PDF file.</a></p>
</object>
Thanks!!
The OP Link actually now succeeds by default, here is the view of requesting no pdf where response is with image on white background
https://dl.dropboxusercontent.com/u/58922976/test.pdf
However it is normal to use a dark or light presentation background for images PowerPoints pdf other viewing
It is entirely up to the viewer
This browser only opens files in external mode
Or why not rainbow friendly?
But for the answer, ask users to do it themselves
For Firefox users there is a hack see How can I enable dark mode when viewing a pdf file in firefox https://stackoverflow.com/a/74564207/10802527
You can but cannot!
I mean,
Every browser (Chrome, Edge, Firefox, Safari, etc.) use their own PDF engine for displaying embedded PDF Files. You can use JavaScript or jQuery to detect the element which has the grey color and change it to white but you'll have to do this for every browser available in the market which is nearly impossible. Moreover, Web Browsers do not provide you an API for this.
The only better solution for this is to make your own PDF Viewer:
You can use this https://mozilla.github.io/pdf.js/ opensource package (By Mozilla) to get it done.
Welcome!

Dynamically Playing MP3 files downloaded with AJAX

I have the need to play an MP3 file on my website downloaded via AJAX like the "Listen" button on the Google Translate page (in fact, I'm doing the exact same thing). How is this done? I don't believe it's facilitated by Flash, so that's not the answer.
I'd suggest loading an iFrame with the sound file embedded within. It's an ugly solution, but it's probably got the best crossbrowser support until HTML5 turns into a thing.