I have some local html files saved on my computer that contain javascript. I am using the mark of the web to make them run in Internet Explorer without getting a security warning every time I open them.
However, I have some MP3 sounds that play when the page is loaded etc and they are not playing after I've inserted the Mark of the Web.
They played before I inserted the mark of the web and had to click on the security warning to run the webpage in IE. They play in firefox.
How can I get the sounds to play in IE when the mark of the web is inserted? Is there a hack or work around for this?
Thanks
Related
I am building a jukebox-like javascript application that runs in the browser. This application will run on a dedicated machine in an exhibition.
It will have to run continuously for 8 hours. At certain moments it will navigate to a different page (or reload current page with different search parameters).
It needs to play audio on all pages. But audio in the browser can only play user-initiated. Is there a way to bypass the user-initiation requirement in chrome or safari? Again, this will be a dedicated machine, so browser flags etc are an option.
If this is not possible in chrome or safari, what would be another solution/environment that can do this?
Your are in total control of the running browser (because you start the kiosk). So you can start the browser without the usual security behavior that prevent auto play.
For example if you are using Google chrome you can start it with chrome.exe --autoplay-policy=no-user-gesture-required
The problem:
On my website mrgigi.me, I have 3 videos that start playing once the videos are visible in the viewport with javascript's .play()/.pause() API.
However, after a few seconds of playing the videos they all freeze on a frame. Checking in the console if the videos are paused with videoID.paused, returns the boolean false.
Meaning that the browser still thinks that the video is playing without any problems.
Using the play/pause buttons also do not work after the video freezes.
A few things to be noted:
This only happens on mobile, on desktop it works perfectly fine.
I am using an iPhone 13 Pro on, at the time of writing, iOS 15.4.1
I tried different mobile browsers which include:
The default browser, Safari
DuckDuckGo Browser
Brave Browser
This only happens when the website is deployed/hosted (so going to the website's domain). It works perfectly fine when using a local server like Live Server
For hosting, I'm using Firebase and Cloudflare
All the code can be found on the GitHub repository: DarthGigi/mrgigi.me
Here are a few videos demonstrating the issue:
Video showing the bug
Video showing the console output
It seems like there was nothing wrong with the code but with the hosting platform I was using, Firebase.
I do not know what the problem exactly was with Firebase, so I switched to Vercel (GitHub Pages would have fixed it too).
Thanks to Jack Latimer for helping me find the cause of the problem and also providing a fix for it!
I'm using a .mp3 file, the .mp3 file plays okay when viewed directly and also when embeded using the HTML5 audio tag, however when creating the HTML5 audio tag in JS it does not play! (very strange)
I do not have this issue in any other browser/device, for example Desktop - Chrome works perfectly.
sound = document.createElement('audio');
sound.setAttribute('src', 'sound.mp3');
sound.play();
I've tested sound.canPlayType('audio/mpeg') and this produces true (so it is supported).
Perhaps there's a bug in Android - Chrome? (it is the latest version)
Looks like this is intended feature that spans more then just the Chrome browser. User interaction is required to get media elements to play.
Blink and WebKit have a setting for requiring a “user gesture” to play or pause an audio or video element, which is enabled in Opera for Android, Chrome for Android, the default Android browser, Safari for iOS and probably other browsers. This makes some sense, since mobile devices are used in public and in bed, where unsolicited sound from random Web sites could be a nuisance. Also, autoplaying video ads would waste bandwidth. Block Quote from 'blog.foolip.org'
Duplicate Threads from Other Users
Autoplay audio on mobile safari
How can I autoplay media in ios 4.2.1
Autoplay audio with ios 5 workaround?
Current Status
Developers have requested the deletion of 'mediaPlaybackRequiresUserGesture' which was reviewed and denied (for now). "We're going to gather some data about how users react to autoplaying videos in order to decide whether to keep this restriction."
Upon further inspection i found this...
"I misunderstood the outcome of the discussion (removing mediaPlaybackRequiresUserGesture) surrounding this topic. We need to keep this code in order to not break google.com while gathering data about this feature."
Google.com relies on the feature being disabled, otherwise it breaks (they didn't say what it breaks).
Original Bug Report
Try appending it to the document body.
document.body.appendChild(sound);
Though it is possible that mobile devices will not automatically play the audio or videos. If you are targeting mobile devices, autoplaying is considered bad practice since it can consume bandwidth. So it may be worth considering adding controls.
sound.setAttribute('controls', 'true');
OK, well, now that we know it won't work with audio, the only path left to you is to switch to the Web Audio API. You'll need to load the mp3 into an ArrayBuffer (e.g. using an XHR), then pass that to the decodeAudioData method, which gets you an Audio buffer that you can play back at will from an AudioBufferSourceNode.
Not every browser on every platform can play the mp3 audio format. Generally, as I would recommend, you should provide two <source> elements within your audio element, one providing the mp3 format, and another one providing the ogg vorbis format.
You can read more here: https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
I'm developing a site with the Soundcloud HTML5 widget and am having trouble loading the widget. It was working fine, but after a lot of page refreshes during development, the widget stops loading. Clearing cookies doesn't work, but opening the page in incognito or a new browser does work. I'm assuming it has something to do with frequent page refreshes, which shouldn't be a problem in production, but it makes me nervous that it might seize up.
Does this issue sound familiar to anyone. The fact that clearing local storage and cookies does nothing, but it does work consistently in another browser or incognito confuses me.
Have you tried looking at your console? (F12 in Chrome and IE), I have experienced these issues when I tried to load to many streams in a short time, preventing access to SoundCloud for a few.
Posting your code could help us give a more specfic answer.
reproduce:
go to http://jsbin.com/bules/1/
open console
go to net panel
see a lot of requests almost every 3seconds from youtube
With open console in chrome it causes memory leak after an hour or so.
Can someone explain why is that happening and why is this call so frequent?
The HTML5 youtube iframe do pulling every ~10 seconds, I guess they are doing it with some sort of socket with Flash and couldn't find a more reliable way to do it with HTML5 (eg: WebSockets are not implemented everywhere).
So this is just part of the normal YouTube HTML5 iframe behavior. Hopefully it will get fixed and replaced by a better system one day.
It's caused by a polling from the player. It checks whether I have my paired smartTV is turned on or not. So it can hide/show the remote-screen button on player.
I found this question when googling to solve the problem. I have the same problem (still, YT haven't solved in a better way). I had requests every ~5 sec. The client (FF) was sending the requests no matter if I had a youtube page up or not.
I found this is solution:
https://support.google.com/youtube/answer/3230451?hl=en
I couldn't manage to turn it off with the instructions for On computer, I had to do it from the TV. And the restart FF to get rid of it.