how can i detect if an iframe video not working - javascript

I've seen some website have a video in multiple video streaming websites like Fembed or vidcast and some of the time the links are broken for whatever reason but I've seen a website that actually detects if the video source is broken and changed to a new one I wonder how can I detect broken link in Iframe?

Related

Change resolution for a video on Chrome using Console

is it possible to change the resolution of an embedded video via console? Previously, I happened to find a pretty cool trick to speed up a video (even exceeding the default speed options) just by typing this command on console document.querySelector('video').playbackRate = 3.0;. I wonder is there any similar trick for video resolution. My specific case is that I am doing online learning and want to have the videos to be of higher resolution. These videos are youtube videos that offer multiple options for resolution (on youtube) but the webpage which I learn somehow doesn't show the button for personal customization. I am a non-tech person so step-by-step guidance would be very appreciated.
Image of Edx Video: Always default at HD
Edx webpage links to the above image: Require account and sign in to view
Link to youtube video: offer multiple quality setting
Try right click on the video and see if you can get the URL of the video, then, watch it in YouTube.
Other options could be (since you're using the Google Chrome console):
Right click on the YouTube video > Inspect element and see the source code: there, for sure the YouTube video link
Or, (in the webpage you're inspecting) press ctrl + u (for get in a separated tab in your browser), then press ctrl + f and search for YouTube.
Any of the previous options will allow you to get the YouTube video in a webpage and you just copy and paste the obtained URL and watch directly the video on YouTube.

How to mute the current tab or block sound for a web site?

I'm looking for a way to mute sound or block it from unauthorized sources,
The problem is that Google Ads is randomly playing videos in ads (very annoying)
For example, I want users to be able to play videos on my web site (I can add a special ID to these allowed elements or data-allowed-element).
I'm wonder if I can hookup to a browser sound event or detect when sound is playing - JavaScript?
Any ideas?
No there is currently no way to detect this browser independent! - There is no event or something else.
Furthermore i dont know exactly how the Google Ads works. I think they are running in an iframe or something which make it harder to detect/mute it.
But may it runns within an audio or video tag, so you can may mute it using the following post. But be careful - You have to mute the video and audio tags within the Google Ads iframe and not within your main window, because then you will have no effect.
https://stackoverflow.com/a/14045788/4275911

SoundCloud and Vimeo synchronize their players in different tabs (and sometimes tabs and embedded players too)

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.

How mobile YouTube page autoplay videos on iOS?

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.

Running YouTube video in iOS 6 by clicking JavaScript button

I am creating an iPad app for running YouTube video using IFrame.
I referred to many questions regarding YouTube integration in UIWebView and understand that:
Autoplay is not possible
Apple doesn't allow to run video without user interaction (starting).
In my simple app, I have a JavaScript button in the first page, and in the next page integrated YouTube with IFrame.
If I click on the JavaScript button, is there any way to pass this click event to the next page for running YouTube?
Is event bubbling in HTML helps this?
As far as I know no, you can't do anything about it. Event triggering can be easily simulated (some example) without user interaction which can't work on iOS devices (because of the policy you mentioned).
iOS video tag (used by YouTube in this case) is handled by iOS browser. Mobile version is showing placeholder with play button which you need to 'tap'. And only this action can play the video. Notice that you can't even overlay video tag with anything, because it will simply not work.

Categories

Resources