我正在尝试将 YouTube 视频放入 Google 地图(v3)信息窗口中。
它在 Firefox 和 Internet Explorer 中运行良好。
It does not在 Safari 和 Chrome 中工作。在这些浏览器中,定位已关闭,并且当您移动地图时视频不会移动。视频有时也会被剪辑。
这是 doe 的代码
<!doctype html>
<html>
<head>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
var map;
function initialize() {
latlng = new google.maps.LatLng(33.4222685, -111.8226402)
myOptions = {
zoom: 4,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map"),myOptions)
var point = new google.maps.LatLng(33.4222685, -111.8226402);
var marker = new google.maps.Marker({
position: point,
map: map
})
google.maps.event.addListener(marker, "click", function(){
bubble = new google.maps.InfoWindow({
content: '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/UmFjNiiVk9w?fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/UmFjNiiVk9w?fs=1" type="application/x-shockwave-flash" width="425" height="344" allowscriptaccess="always" allowfullscreen="true"></embed></object>'
})
bubble.open(map, marker);
})
}
</script>
</head>
<body onload="initialize();">
<div id="map" style="width: 984px; height: 495px"></div>
</div>
</body>
</html>
这里有一个适用于 Google Maps API 版本 2 的示例http://www.virtualvideomap.com/ http://www.virtualvideomap.com/
Also on http://maps.google.com http://maps.google.com您可以通过单击地图右上角的“更多...”,然后选中“视频”,在 Chrome 和 Safari 中的信息窗口内查看 YouTube 视频。