Playing audio definitely needs user interaction on mobiles but, my question is does loading audio also need user interaction?
If yes, what I want to do is preload the audio so when the user taps the play button, the audio can start playing faster, as it has already started loading.
User interaction need to load and play the audio or video in mobile device, Mobile device avoiding auto play on audio and video for bandwidth limitation. Sorry i cant comment that's why i post in answer.
Related
Safari and Chrome is not allowing video to autoplay if sound is on by default (unmuted). If you mute the video, it will autoplay, and the user is forced to enable sound. Fine and well, I can live with this.
However, in researching this, I found that YouTube (Safari 11, MacOS High Sierra), is allowing subsequent videos to be played with sound ON if the user turns sound on for a given video. Likewise, if user mutes the video, clicks onto a different video, this video will autoplay muted until user toggles the sound on. I would love to replicate this on a site in which I have created a video gallery of sorts. Each video does live on it's own page, and navigating the gallery will take user to a new page in the browser. This needs to stay the same, for multiple reasons (as opposed to creating a single media element and dynamically changing video source).
Alternatively, is there a way to convince Safari that a user has intentionally clicked a button in order to watch a video, thus allowing autoplay with sound on, when the user is simply clicking a link (in the form of a "Play Video Now" button) to a page with the video embedded?
Is it possible to make an external play button for a video without the play button in the video?
For example when you want to start a youtube video you see a red button in the middle of it. I want that hidden and a button outside of the video to start the video. It doesn't matter what video player it is.
I want to do this because iPad does not allow autoplay. And using the external button I want to trick it to autoplay.
This is a website that does "autoplay" on the iPad.
http://24hoursofhappy.com/
There is a reason why YouTube doesn't allow autoplay on mobile/tablet devices, video's use up alot of bandwith which may become expensive for the user.
U can trick it like u mentioned with a custom play button or even force it to start playing without a custom button. There is alot of detailed information on YouTube's API page.
Check out this page: https://developers.google.com/youtube/
I'd refrain from always autoplaying a video though if not just for bandwith reasons. In your case u could check if the device is a tablet.
I finally found an answer for this using HTML5 videos. It allows me to use the control buttons externally so I can use an overlay and hide the overlay when the play button is clicked so it will seem like it is auot played.
I'm developing a mobile web app using HTML5 & Javascript. The goal is to have a page with buttons that play sound after touch events, using the HTML5 audio tag. But I'm noticing a significant delay between the touch event and the sound being played, even after the audio file has been cached. I think this may be due to the way iOS Safari handles sound but I'm not sure. Are there any solutions or creative workarounds to this issue? How can I minimize the delay between the touch event and playback?
The audio delay may be because of buffering issues in iOS that are there due to cellular data charges. The user has to explicitly trigger the event in order for the content to start being downloaded.
In Safari on iOS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, preload and autoplay are disabled. No data is loaded until the user initiates it. This means the JavaScript play() and load() methods are also inactive until the user initiates playback, unless the play() or load() method is triggered by user action. In other words, a user-initiated Play button works, but an onLoad="play()" event does not.
-https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html#//apple_ref/doc/uid/TP40009523-CH5-SW1
=== EDIT ===
One potential improvement is to use lower bitrate/ higher compressed audio for mobile products. The quality will, however, be significantly reduced. Use only if it is acceptable in your application.
I'm trying to get it understand but after 2 days of digging the code I thought that I will post my issue here...
According to Apple's documentation, autoplaying videos on iOS devices cannot be done without user interaction first (e.g. tap on video). Despite that, mobile YouTube (m.youtube.com) is able to autoplay its videos just after loading a page with video.
Does anyone know how they are doing it?
PS. I've checked all available JS/HTML techniques of autoplaying videos on website on iOS (e.g. iframe, fake click, triggering touch event on video, fetching video with XHR).
I believe that youtube.com is a single page app. So when the user clicks on the video from the list view the page is not loading and their javascript uses that initial click, that leads to the video page, as the click that starts the video. It's not actually autoplaying, it's just a trick.
I want to automatically play a YouTube video but because of how YouTube's view counter is set up, autoplay views will not count as views.
How can I simulate a user interaction tap in a UIWebView so YouTube thinks that the user pressed/tapped play?
Or do you "think" that a very near version of iOS will support this?
Trying to phrase that in NDA accordance. Do you think it would work if I changed the user agent of the UIWebView to a desktop user agent and displayed a standard YouTube page?
On the desktop YouTube videos autoplay on Youtube.com but this does not work on mobile.
I have set mediaPlaybackRequiresUserAction to no.