【问题标题】:Is it possible to use fitVids or fluidVids with the YouTube iFrame API?是否可以通过 YouTube iFrame API 使用 fitVids 或 fluidVids?
【发布时间】:2014-05-15 21:04:13
【问题描述】:

我能够毫无问题地渲染视频,只是我还没有发现可以将播放器与 fitVids 或 fluidVids 一起使用。我假设这是因为 iframe 是由 JavaScript 生成的,并且不适用于调整大小的脚本。有没有可能的解决方法?

var youTubeApi = {

    player: '',

    init: function(){
        // Let's get the API script
        $.getScript('//www.youtube.com/iframe_api');
        // The API will ask for the player
        youTubeApi.createPlayer();
    },
    createPlayer: function(){

        onYouTubeIframeAPIReady = function(){
            youTubeApi.player = new YT.Player('player',{
                videoId: 'sF4fn82tWmQ',
                playerVars:{
                    autoplay: 1,
                    autohide: 1
                }
            })
        }
    }

}
youTubeApi.init();

谢谢!!

【问题讨论】:

    标签: javascript iframe youtube


    【解决方案1】:

    在加载 Youtube iframe 后检查您是否正在初始化 FluidVids。

    fluidvids.init();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-03-28
      • 2018-08-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-11
      相关资源
      最近更新 更多