Jump to content

Audiophile

Members
  • Posts

    6
  • Joined

  • Last visited

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Audiophile's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Sometimes I add audio to websites that I develop. But when I test my code with my browsers (Chrome and Edge), although they display my code they refuse to play the audio. Surely this is intentional because they have no trouble playing audio AFTER a website is deployed and given a URL. So I have found a way to FORCE these browsers to play audio without any URL. The trick is to use the html instruction "iframe". The file "index.html" body is as follows: <body> <iframe src= "welcome.html" style= "height:1024px; width:100%; border:none;"> </iframe> </body> The file "welcome.html" runs automatically following "index.html". It MUST contain a hyperlink to the next file which should include the audio code.
  2. When I create a new website, I test the prototype by opening the index.html file with my browser (Google Chrome or Microsoft Edge). But the browser refuses to play the audio content (if present). I don't know why, but this is probably intentional. I have discovered that the browser can be forced to play the audio content if the prototype website is played through the html "iframe" tag. This seems to work perfectly well but I have no idea why. Here follow the instructions to achieve this: (1). Inside the index.html file insert the following code: <a target="_self" href="FREDS-SUBSEQUENT-file.html"> <iframe class="FREDS-CSS-label" src="FREDS-folder/FREDS-file.html" style ="height:1024px;width:100%; border:none;"> </iframe> </a> Note: The above code <a target="_self" href="FREDS-SUBSEQUENT-file.html"> may be unnecessary. (It would provide a hyperlink if the file in FREDS-folder were a .jpg or other graphic file). (2). It is better NOT to insert your "audio" code inside the index.html file. If you do, the "audio" will not play when the index.html file first runs. However, the "audio" would play if the "index.html" file runs subsequently. (3). Unless you already have a stylesheet, inside <head> </head> insert: <link rel="stylesheet" href="mystyle.css"> (4). Inside the CSS file "mystyle=css" insert the following code: @media only screen { .FREDS-CSS-label { display: block; width: 100%; align: center; } }
  3. Yes precisely. I think I should not have to upload a prototype website to a host (server) until I have completely debugged it on my o/s file system. Which I can do in every respect EXCEPT the sound!
  4. When I develop a website (with audio) on my PC, I need to test it, including testing the sound. I don't want to upload it to a server until I am fairly confident that it all works OK. BUT until it gets uploaded to a server it has no domain name. So I open the index.html file with my browser (Google Chrome or Microsoft Edge). This displays the prototype website, but it does NOT produce any sound. I have tried your kind suggestion above by entering "index.html" as the address. The browser pretends to accept this, but still refuses to produce any sound. I suspect this is intentional.
  5. When creating a Website it is obviously advantageous to debug it totally within the PC. This avoids having to upload it to a host in order to debug it. But when I right-click on "index.html" and select "Open with" and click on "Google Chrome", although the program runs there is no SOUND ! The Chrome html interpreter thus discriminates against against a PC-internal program versus an Internet-derived program. I presume this is no bug but rather is the consequence of some obscure principle. Also there seem to be some obscure differences between the treatment of <audio> tags between Chrome on Windows 7 versus Windows 10. If your websites are old enough to have been created with Winsows 7, you might consider testing the SOUND using Chome on Windows 10.
  6. 1. In a mobile or tablet PC, an <audio> tag will not be enabled until after a hyperlink has been employed. So I used a silent "Welcome" screen inviting the user to "click" in order to proceed further. 2. If a background audio file is required to survive page transition, then a solution is to use the <frameset> tag. I created two frames called "Left" and "Right". "Left" width = 0% and "Right" width = 100%. Hence "Left" cannot be displayed. The "Left" frame sources a page containing the <audio> tag, while the "Right" frame sources everything-else. NOTE: The <frameset> tag was supported in HTML4 but allegedly not in HTML5. 3. If it is required to stop an audio file playing (after it has started), this may be done by employing any hyperlink. (I am not sure whether this applies to hyperlinks where the href attribute is an external URL, eg. a network). But the condition is that the hyperlink must have the attribute target=_top. Such hyperlinks may reference a page containing an alternative <audio> tag and an alternative audio file which therefore will replace the one that was stopped.
×
×
  • Create New...