我有一个vimeo视频,当用户点击一个div时加载。jquery和vimeo:不会自动播放
<div class="vimeobox" ID="vimeo-ID-goes-here"></div>
这里是我的javascript:
$(".vimeobox").click(function() {
var iframe = "<iframe />";
var id = $(this).attr('id'); //
var url = "http://player.vimeo.com/video/" + id + "?title=0&byline=0&portrait=0&autoplay=1";
var width = 700;
var height = 394;
var frameborder = 0;
$(iframe, {
name: 'videoframe',
id: 'videoframe',
src: url,
width: width,
height: height,
frameborder: frameborder,
type: 'text/html',
allowfullscreen: true,
webkitAllowFullScreen: true,
mozallowfullscreen: true
}).css({'position': 'absolute', 'top': '0', 'left': '0'}).appendTo(this);
$(this).find('img').fadeOut(function() { $(this).remove();
});
});
被点击(删除预览图像)div时VIMEO播放器出现......但视频没有自动播放。
我不知道问题是什么。我为youtube播放器使用几乎相同的代码(减去url变量)并自动播放?
完全工作!我想知道为什么链接在vimeo嵌入代码中以这种方式呈现? – redconservatory 2012-03-08 18:34:38
我不知道,通常这是用作分隔符的'?',所以你不必转义&符号(但是只要HTTP服务器有很多可用作分隔符的有效字符支持他们)。 – talnicolas 2012-03-08 18:46:57