MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    Autoplaying videos with MMM-iFrame-Ping

    Entertainment
    2
    4
    344
    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
      JoeRonimo last edited by

      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 Reply Quote 0
      • S
        sdetweil @JoeRonimo last edited by

        @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

        Create a working config
        How to add modules

        J 1 Reply Last reply Reply Quote 0
        • J
          JoeRonimo @sdetweil last edited by JoeRonimo

          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 Reply Quote 0
          • S
            sdetweil @JoeRonimo last edited by

            @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

            Create a working config
            How to add modules

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy