YouTube嵌入无法自动播放视频

时间:2020-01-23 13:02:37

标签: javascript youtube

我想在用户单击观看视频后加载youtube视频。

所以我添加了我的代码:

   video_wrapper.on('click', function () {
                video_wrapper.addClass("done");
                /* Dynamically inject the iframe on demand of the user.
                 Pull the youtube url from the data attribute on the wrapper element. */
                video_container.html('<iframe allowfullscreen frameborder="0" class="embed-responsive-item" src="' + video_container.data('yt-url') + '"></iframe>');
            });

此代码的来源为https://medium.com/@ryanlebel/speed-up-page-load-time-c6b9148d0a2

我的问题是,即使我在视频网址中添加了autoplay = 1,视频也无法自动播放

0 个答案:

没有答案
相关问题