Perspective iFrame Youtube video autostart

Is there a way to have a youtube video autostart? I’ve added the “&autoplay=1” to the url, but with no luck. Nothing I seem to do is able to get the video to start automatically.

I do get the following error in the console, but I cannot seem to make heads or tails of it.

15:46:18.926 [Browser Events Thread] INFO Perspective.Designer.BrowserConsole - Mixed Content: The page at 'https://www.youtube.com/embed/9Auq9mYxFEE' was loaded over HTTPS, but requested an insecure script 'chrome-extension://enhhojjnijigcajfphajepfemndkmdlo/cast_sender.js'. This request has been blocked; the content must be served over HTTPS.

I’d settle for a way to programmatically click on the iFrame, but I’m assuming I cannot figure that one out either because it would be some sort of security hole.

Oddly, I can get some videos to autoplay, but not others. I originally thought it might be a browser restriction on autoplaying content with sound, but amusingly this video seems to work fine with autoplay=1, even in a Perspective session:

1 Like

Umm…So where do I go from here?

I can’t really tell you. Some videos working but not others rules out browser restrictions, and the fact I can get Perspective videos to autoplay rules out something we’re not doing on our end. It looks like the discrepancy is on Youtube.

Ah ha… you need to have the start command on some of these videos…

link needs to have ?autoplay=1;start=0

3 Likes

A little more information......Google updated their autoplay policy in 2018. There can be a variety of reasons why a video is not permitted to autoplay. Some videos will not permit themselves to be autoplayed with the sound on, so adding the &mute=1 flag solves that. Some do not allow to be autoplayed unless the start location is specified (use &start=0 to start at the beginning)

Here is the format I use to autoplay, start at 0, mute the sound, set the language to 0 and turn on closed captioning.

For reference, I use this on a digital sign in the office and lab. It rotates through a bunch of different sets of information:

  • displays traditional information from the plant
  • some images that are uploaded with pertinent information for the employees
  • I am mixing in some other media to change keep people looking at the screen, such as local weather and now going out and grabbing the bbc or sky news and playing 30 sec or a minute of closed caption news.

Here is the most recent autoplay policy for reference.

1 Like

Are you doing this on an RPi through Chromium?

Since April 2018, Google made some changes to the Autoplay Policy. You not only need to add the autoplay=1 as a query param, but also add allow='autoplay' as an iframe's attribute

So while embed youtube video, you will have to do something like this:

<iframe src="https://www.youtube.com/embed/VIDEO_ID?autoplay=1" allow='autoplay'></iframe>