YouTube: How to present embed video with sound muted

后端 未结 12 1237
天命终不由人
天命终不由人 2020-11-29 02:16

I\'m trying to embed a video with the sound muted but I can not figure out how it make it work.

Currently I\'m using this but doesn\'t work:



        
相关标签:
12条回答
  • 2020-11-29 02:51

    I would like to thank the friend who posted the codes below in this area. I finally solved a problem that I had to deal with all day long.

    <div id="muteYouTubeVideoPlayer"></div>
                                <script async src="https://www.youtube.com/iframe_api"></script>
                                <script>
                                    function onYouTubeIframeAPIReady() {
                                        var player;
                                        player = new YT.Player('muteYouTubeVideoPlayer', {
                                            videoId: 'xCIBR8kpM6Q', // YouTube Video ID
                                            width: 1350, // Player width (in px)
                                            height: 500, // Player height (in px)
                                            playerVars: {
                                                autoplay: 1, // Auto-play the video on load
                                                controls: 0, // Show pause/play buttons in player
                                                showinfo: 0, // Hide the video title
                                                modestbranding: 0, // Hide the Youtube Logo
                                                loop: 1, // Run the video in a loop
                                                fs: 0, // Hide the full screen button
                                                cc_load_policy: 0, // Hide closed captions
                                                iv_load_policy: 3, // Hide the Video Annotations
                                                autohide: 0, // Hide video controls when playing
                                                rel: 0 
                                            },
                                            events: {
                                                onReady: function(e) {
                                                    e.target.setVolume(5);
                                                }
                                            }
                                        });
                                    }
    
                                    // Written by @labnol
    
                                </script>

    0 讨论(0)
  • 2020-11-29 02:53

    Just pass mute=1.

    For example:

    <iframe id="myVideo" src="https://www.youtube.com/embed/k0DN-BZrM4o?rel=0&amp;autoplay=1;mute=1" width="100%" height="600" frameborder="0" allowfullscreen></iframe>
    
    0 讨论(0)
  • 2020-11-29 02:54

    <iframe  src="https://www.youtube.com/embed/7cjVj1ZyzyE?autoplay=1&loop=1&playlist=7cjVj1ZyzyE&mute=1" frameborder="0"  allowfullscreen></iframe>

    mute=1

    0 讨论(0)
  • 2020-11-29 02:55

    This is easy. Just add mute=1 to the src parameter of iframe.

    Example:

    <iframe src="https://www.youtube.com/embed/uNRGWVJ10gQ?controls=0&mute=1&showinfo=0&rel=0&autoplay=1&loop=1&playlist=uNRGWVJ10gQ" frameborder="0" allowfullscreen></iframe>
    
    0 讨论(0)
  • 2020-11-29 02:56

    For me works using &autoplay=1&mute=1

    0 讨论(0)
  • 2020-11-29 02:58

    Try this

    <iframe width="420" height="315" src="http://www.youtube.com/embed/
    HeQ39bLsoTI?autoplay=1&cc_load_policy=1" volume="0" frameborder="0"
    allowfullscreen></iframe>
    

    don't forget to write volume="0"

    0 讨论(0)
提交回复
热议问题