Camera code and background audio run code not working on my site

###M.Sultan

[textnow version]

Error Message

Video embed camera not working. Also no background audio clips play automatically.

Other Information

I want when someone opens a page on my website to have their camera turned on. I used the exact code that works in XAMPP . But it does not work on infinityfree.

Your browser may have assigned special permissions to localhost, so you need to make sure that you give that same permission to your live site.

Here’s a good guide from web.dev that describes how to capture a user input stream.
https://web.dev/getusermedia-intro/

Note that using InfinityFree as a live chat site, either text or audiovideo call, is not allowed.

4 Likes

I used this code for ringing but’s it’s not working

      <audio src="ringtone.mp3" autoplay loop></audio>

For one, Apple owns that ringtone, so you can’t just use it. Also, some browsers (Like mine), block audio that tries to play on page load.

5 Likes

Apple owns that ringtone, so you can’t just use it it’s not a right answer.

Yes, it is. Apple owns the rights to the Circuit Ringtone (the one you used) and did not give you permission to use it in your project. Therefore, you cannot legally use that audio.

I took two minutes and Googled royalty-free ringtones, and I came across this one. Plus, they have licensing information available on the page as well:

4 Likes

I would appreciate it if you could give me an example code to make it work for all browsers. I changed the audio but it still doesn’t play

I’m not sure this exists. Many browsers block autoplay because most people don’t like it when music starts blasting the moment they open a web page without warning. Maybe you could work around it with Javascript hacks, but be aware that by doing so you’re deliberately bypassing browser configuration of the visitor, which is bad practice.

6 Likes

Very unlikely, since browsers have full control on whether or not you are allowed to autoplay.

It would be best to look into what rules the browsers have for when you can play audio (or video) automatically.

To get started, two of the biggest browsers in use have some documentation about autoplay:

I would guess that most other browsers have similar rules to Chrome and FF.

6 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.