• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Autoplaying videos with MMM-iFrame-Ping

Scheduled Pinned Locked Moved Entertainment
4 Posts 2 Posters 692 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    JoeRonimo
    last edited by Aug 26, 2021, 9:43 PM

    I’ve heard that MagicMirror stopped autoplaying videos in the browser since about version 2.10. I would like to use the MMM-iFrame-Ping module to play news videos in the mornings at my MagicMirror. I also noticed that a lot of websites like CBSNews, NBCNews, CNN, and Haystack.tv stopped autoplaying videos when you go to their websites.

    I don’t want to use a keyboard or mouse with my MM. Can anyone think of a way to script these sites to play their videos when the iFrame opens?

    S 1 Reply Last reply Aug 26, 2021, 10:06 PM Reply Quote 0
    • S Offline
      sdetweil @JoeRonimo
      last edited by Aug 26, 2021, 10:06 PM

      @joeronimo yes, in 2,10 I added the setting to electron to allow auto play

      electron changed the setting again ,

      from https://www.electronjs.org/docs/api/browser-window

      u will have to edit the code

      MagicMirror/js/electron.js

      add to the webPreferences

      		darkTheme: true,
      		webPreferences: {
      			contextIsolation: true,
      			nodeIntegration: false,
      			zoomFactor: config.zoom
      		},
      
      autoplayPolicy: 'no-user-gesture-required',
      

      but

      autoplayPolicy String (optional) - Autoplay policy to apply to content in the window, can be no-user-gesture-required, user-gesture-required, document-user-activation-required. 
      
      
      Defaults to no-user-gesture-required.  <-------
      

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      J 1 Reply Last reply Aug 29, 2021, 1:38 AM Reply Quote 0
      • J Offline
        JoeRonimo @sdetweil
        last edited by JoeRonimo Aug 29, 2021, 1:38 AM Aug 29, 2021, 1:38 AM

        Thank you for answering @sdetweil , unfortunately, that didn’t work. I tried it with several sites that have a video at the top of their page, but none of them autoplayed if they even loaded at all into the iFrame.

        Anyway, this is what I put into my electron.js:

        	darkTheme: true,
        	webPreferences: {
        		autoplayPolicy: 'no-user-gesture-required',
                        contextIsolation: true,
        		nodeIntegration: false,
        		zoomFactor: config.zoom
        	},
        

        Is there something else that I need to do? With so many websites turning autoplay off, do you think we can simulate a mouse-click event in the middle of the iFrame after the page loads by modifying the MMM-iFrame-Ping.js file?

        S 1 Reply Last reply Aug 29, 2021, 2:11 AM Reply Quote 0
        • S Offline
          sdetweil @JoeRonimo
          last edited by Aug 29, 2021, 2:11 AM

          @joeronimo i do not know… they have been increasing the controls here to stop autoplay, cause customers are screaming…

          i still yell at my phone browser every day cause it plays something I don’t think it should.

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          1 / 1
          • First post
            4/4
            Last post
          Enjoying MagicMirror? Please consider a donation!
          MagicMirror created by Michael Teeuw.
          Forum managed by Sam, technical setup by Karsten.
          This forum is using NodeBB as its core | Contributors
          Contact | Privacy Policy