Often when browsing in Firefox, I'll right click on a link, and open it in a separate tab to view later, and go on reading the current page. When the link is a Youtube script, however, playback starts immediately even though the tab isn't active. Other video players (like fora.tv and TED.com) don't start playback until you activate that tab.
Is there a greasemonkey script that I can use to make sure that videos (and especially Youtube videos) are paused unless their tab is active?
I found two options:
"Youtube Alternate Video Player" (greasemonkey script)
http://userscripts.org/scripts/show/13955
Script Summary:
Replaces the youtube flash video player with FlowPlayer flash video player.
replaces the youtube player
no hd
no 16:9
Firefox Add-On "TubeStop"
http://www.chrisfinke.com/addons/tubestop/
disables the autoplay on YouTube videos
does it every time (even if the tab is active)
I will keep the TubeStop addon for now.
I think Youtube now does this by default (only playing a video when the tab the video is in is activated)
Related
I am developing a website and I am using a video as my hero container in my main page. The video is set to autoplay as soon as the page loads. On IOS low battery mode, I found out that it stops video autoplay in order to save battery life. What are my possible solutions to fix this problem.
The play button is shown on the video. Is it possible to force the video to play or even hide the playbutton of the video?
Is there any event listeners that work aside from suspend because that did not work for me.
I noticed that if you open a YouTube link, the video will start autoplaying with sound, even if I haven't interacted with the page.
For what I know, the browser needs the user to interact with the page to allow unmuted videos.
How does YouTube that? How can I implement it to my webpage?
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?
I like how SoundCloud and Vimeo have their various tabs synchronized so as soon as you start playing something in one tab, the other tabs pause. What's more interesting is that this only works on SoundCloud when two instances of the website are open, but for Vimeo this happens even between a Vimeo website tab (with the video playing) and a Vimeo video embedded on say The Verge (http://www.theverge.com/2014/12/22/7433775/watch-the-styles-of-your-favorite-directors-recreated-with-stock). However when the Vimeo video is embedded on Facebook (when I had shared it) it doesn't work.
I was wondering if one of the techniques mentioned on Javascript: sharing data between tabs is used here and if yes, why doesn't it work when the Vimeo video is embedded on Facebook and I have another tab playing Vimeo video.
So, I just inspected and indeed both SoundCloud and Vimeo use a localStorage solution. Vimeo has a key from https://f.vimeocdn.com called sync_active which updates to whichever video is playing currently or last played (if all the videos are paused). They have this key even when a Vimeo video is embedded on The Verge and hence this works there as well. However in the case of Facebook, Vimeo doesn't have any localStorage and hence no synchronization happens.
In the case of SoundCloud, it also has a key from https://soundcloud.com called V2::local::inst_<id> which gets updated to whichever tab is playing. They don't have this localStorage even when SoundCloud is embedded on The Verge and hence this only works between various SoundCloud website tabs.
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.